From 4c00ae3b29b3f655bdf559cf2a4c73c93cf0e71b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 21 Jun 2018 08:54:47 -0700 Subject: [PATCH 01/17] Generated from 8a72b9ba5c2b5c8621cd628c62702a0bd4933259 (#2122) Adding to all package-composite-v* and package-pure of appropriate version --- sql/resource-manager/v2014_04_01/pom.xml | 133 + .../sql/v2014_04_01/AuthenticationType.java | 53 + .../CheckNameAvailabilityReason.java | 53 + .../CheckNameAvailabilityRequest.java | 78 + .../CheckNameAvailabilityResponse.java | 40 + .../sql/v2014_04_01/CreateMode.java | 59 + .../management/sql/v2014_04_01/Database.java | 546 ++++ .../sql/v2014_04_01/DatabaseEdition.java | 68 + .../DatabaseSecurityAlertPolicy.java | 305 +++ .../DatabaseThreatDetectionPolicies.java | 31 + .../sql/v2014_04_01/DatabaseUpdate.java | 726 ++++++ .../management/sql/v2014_04_01/Databases.java | 151 ++ .../sql/v2014_04_01/ElasticPool.java | 292 +++ .../v2014_04_01/ElasticPoolActivities.java | 30 + .../sql/v2014_04_01/ElasticPoolActivity.java | 142 ++ .../ElasticPoolDatabaseActivities.java | 30 + .../ElasticPoolDatabaseActivity.java | 117 + .../sql/v2014_04_01/ElasticPoolEdition.java | 44 + .../sql/v2014_04_01/ElasticPoolState.java | 44 + .../sql/v2014_04_01/ElasticPoolUpdate.java | 238 ++ .../sql/v2014_04_01/ElasticPools.java | 53 + .../sql/v2014_04_01/ExportRequest.java | 175 ++ .../sql/v2014_04_01/FirewallRule.java | 125 + .../sql/v2014_04_01/FirewallRules.java | 53 + .../sql/v2014_04_01/ImportExportResponse.java | 250 ++ .../v2014_04_01/ImportExtensionRequest.java | 267 ++ .../sql/v2014_04_01/ImportRequest.java | 132 + .../sql/v2014_04_01/OperationImpact.java | 77 + .../management/sql/v2014_04_01/ReadScale.java | 53 + .../v2014_04_01/RecommendedElasticPool.java | 94 + .../RecommendedElasticPoolMetric.java | 36 + .../v2014_04_01/RecommendedElasticPools.java | 52 + .../sql/v2014_04_01/RecommendedIndex.java | 210 ++ .../v2014_04_01/RecommendedIndexAction.java | 56 + .../v2014_04_01/RecommendedIndexState.java | 80 + .../sql/v2014_04_01/RecommendedIndexType.java | 59 + .../sql/v2014_04_01/ReplicationLink.java | 93 + .../sql/v2014_04_01/ReplicationLinks.java | 79 + .../sql/v2014_04_01/ReplicationRole.java | 62 + .../sql/v2014_04_01/ReplicationState.java | 47 + .../sql/v2014_04_01/SampleName.java | 38 + ...SecurityAlertPolicyEmailAccountAdmins.java | 53 + .../v2014_04_01/SecurityAlertPolicyState.java | 56 + .../SecurityAlertPolicyUseServerDefault.java | 53 + .../management/sql/v2014_04_01/Servers.java | 28 + .../sql/v2014_04_01/ServiceObjectiveName.java | 230 ++ .../sql/v2014_04_01/ServiceTierAdvisor.java | 135 + .../sql/v2014_04_01/ServiceTierAdvisors.java | 42 + .../sql/v2014_04_01/SloUsageMetric.java | 72 + .../sql/v2014_04_01/StorageKeyType.java | 53 + .../TransparentDataEncryption.java | 45 + .../TransparentDataEncryptionActivities.java | 30 + .../TransparentDataEncryptionActivity.java | 50 + ...ansparentDataEncryptionActivityStatus.java | 41 + .../TransparentDataEncryptionStatus.java | 53 + .../TransparentDataEncryptions.java | 41 + .../CheckNameAvailabilityResponseImpl.java | 47 + .../CheckNameAvailabilityResponseInner.java | 82 + .../implementation/DatabaseImpl.java | 442 ++++ .../implementation/DatabaseInner.java | 719 ++++++ .../DatabaseSecurityAlertPolicyImpl.java | 202 ++ .../DatabaseSecurityAlertPolicyInner.java | 283 +++ .../DatabaseThreatDetectionPoliciesImpl.java | 55 + .../DatabaseThreatDetectionPoliciesInner.java | 264 ++ .../implementation/DatabasesImpl.java | 193 ++ .../implementation/DatabasesInner.java | 2264 +++++++++++++++++ .../ElasticPoolActivitiesImpl.java | 49 + .../ElasticPoolActivitiesInner.java | 159 ++ .../ElasticPoolActivityImpl.java | 148 ++ .../ElasticPoolActivityInner.java | 348 +++ .../ElasticPoolDatabaseActivitiesImpl.java | 49 + .../ElasticPoolDatabaseActivitiesInner.java | 159 ++ .../ElasticPoolDatabaseActivityImpl.java | 123 + .../ElasticPoolDatabaseActivityInner.java | 273 ++ .../implementation/ElasticPoolImpl.java | 251 ++ .../implementation/ElasticPoolInner.java | 229 ++ .../implementation/ElasticPoolsImpl.java | 81 + .../implementation/ElasticPoolsInner.java | 741 ++++++ .../implementation/FirewallRuleImpl.java | 126 + .../implementation/FirewallRuleInner.java | 105 + .../implementation/FirewallRulesImpl.java | 81 + .../implementation/FirewallRulesInner.java | 456 ++++ .../implementation/IdParsingUtils.java | 57 + .../ImportExportResponseImpl.java | 219 ++ .../ImportExportResponseInner.java | 156 ++ .../v2014_04_01/implementation/PageImpl.java | 75 + .../RecommendedElasticPoolImpl.java | 130 + .../RecommendedElasticPoolInner.java | 234 ++ .../RecommendedElasticPoolMetricImpl.java | 46 + .../RecommendedElasticPoolMetricInner.java | 97 + .../RecommendedElasticPoolsImpl.java | 88 + .../RecommendedElasticPoolsInner.java | 351 +++ .../implementation/ReplicationLinkImpl.java | 117 + .../implementation/ReplicationLinkInner.java | 194 ++ .../implementation/ReplicationLinksImpl.java | 84 + .../implementation/ReplicationLinksInner.java | 749 ++++++ .../implementation/ServersImpl.java | 42 + .../implementation/ServersInner.java | 143 ++ .../ServiceTierAdvisorImpl.java | 158 ++ .../ServiceTierAdvisorInner.java | 318 +++ .../ServiceTierAdvisorsImpl.java | 65 + .../ServiceTierAdvisorsInner.java | 263 ++ .../SqlManagementClientImpl.java | 350 +++ .../implementation/SqlManager.java | 231 ++ ...ansparentDataEncryptionActivitiesImpl.java | 49 + ...nsparentDataEncryptionActivitiesInner.java | 160 ++ ...TransparentDataEncryptionActivityImpl.java | 57 + ...ransparentDataEncryptionActivityInner.java | 68 + .../TransparentDataEncryptionImpl.java | 52 + .../TransparentDataEncryptionInner.java | 63 + .../TransparentDataEncryptionsImpl.java | 54 + .../TransparentDataEncryptionsInner.java | 352 +++ .../implementation/package-info.java | 11 + .../sql/v2014_04_01/package-info.java | 11 + .../v2017_10_01_preview/pom.xml | 133 + .../BackupShortTermRetentionPolicies.java | 42 + .../BackupShortTermRetentionPolicy.java | 90 + .../sql/v2017_10_01_preview/Capabilities.java | 26 + .../v2017_10_01_preview/CapabilityGroup.java | 44 + .../v2017_10_01_preview/CapabilityStatus.java | 59 + .../CatalogCollationType.java | 41 + .../sql/v2017_10_01_preview/CreateMode.java | 65 + .../sql/v2017_10_01_preview/Database.java | 613 +++++ .../DatabaseLicenseType.java | 41 + .../DatabaseOperation.java | 106 + .../DatabaseOperations.java | 44 + .../DatabaseReadScale.java | 41 + .../v2017_10_01_preview/DatabaseStatus.java | 89 + .../v2017_10_01_preview/DatabaseUpdate.java | 712 ++++++ .../DatabaseVulnerabilityAssessment.java | 100 + .../DatabaseVulnerabilityAssessmentScans.java | 66 + ...aseVulnerabilityAssessmentScansExport.java | 40 + .../sql/v2017_10_01_preview/Databases.java | 109 + .../EditionCapability.java | 105 + .../sql/v2017_10_01_preview/ElasticPool.java | 267 ++ .../ElasticPoolEditionCapability.java | 105 + .../ElasticPoolLicenseType.java | 41 + .../ElasticPoolOperation.java | 106 + .../ElasticPoolOperations.java | 44 + ...DatabaseMaxPerformanceLevelCapability.java | 106 + ...DatabaseMinPerformanceLevelCapability.java | 90 + .../ElasticPoolPerDatabaseSettings.java | 69 + ...ElasticPoolPerformanceLevelCapability.java | 180 ++ .../v2017_10_01_preview/ElasticPoolState.java | 44 + .../ElasticPoolUpdate.java | 179 ++ .../sql/v2017_10_01_preview/ElasticPools.java | 53 + .../InstanceFailoverGroup.java | 166 ++ ...InstanceFailoverGroupReadOnlyEndpoint.java | 44 + ...nstanceFailoverGroupReadWriteEndpoint.java | 73 + .../InstanceFailoverGroupReplicationRole.java | 41 + .../InstanceFailoverGroups.java | 75 + .../LicenseTypeCapability.java | 74 + .../LocationCapabilities.java | 46 + .../LogSizeCapability.java | 48 + .../sql/v2017_10_01_preview/LogSizeUnit.java | 50 + .../ManagedInstanceEditionCapability.java | 90 + .../ManagedInstanceFamilyCapability.java | 150 ++ .../ManagedInstancePairInfo.java | 69 + .../ManagedInstanceTdeCertificates.java | 31 + .../ManagedInstanceVcoresCapability.java | 89 + .../ManagedInstanceVersionCapability.java | 90 + .../ManagementOperationState.java | 53 + .../MaxSizeCapability.java | 48 + .../MaxSizeRangeCapability.java | 120 + .../sql/v2017_10_01_preview/MaxSizeUnit.java | 47 + .../PartnerRegionInfo.java | 59 + .../PerformanceLevelCapability.java | 48 + .../PerformanceLevelUnit.java | 41 + .../ReadOnlyEndpointFailoverPolicy.java | 41 + .../ReadWriteEndpointFailoverPolicy.java | 41 + .../ResourceMoveDefinition.java | 43 + .../sql/v2017_10_01_preview/SampleName.java | 44 + .../ServerVersionCapability.java | 105 + .../ServiceObjectiveCapability.java | 166 ++ .../sql/v2017_10_01_preview/Sku.java | 152 ++ .../v2017_10_01_preview/TdeCertificates.java | 31 + ...ityAssessmentRecurringScansProperties.java | 98 + .../VulnerabilityAssessmentScanError.java | 47 + .../VulnerabilityAssessmentScanRecord.java | 79 + .../VulnerabilityAssessmentScanState.java | 47 + ...ulnerabilityAssessmentScanTriggerType.java | 41 + .../BackupShortTermRetentionPoliciesImpl.java | 74 + ...BackupShortTermRetentionPoliciesInner.java | 1135 +++++++++ .../BackupShortTermRetentionPolicyImpl.java | 100 + .../BackupShortTermRetentionPolicyInner.java | 47 + .../implementation/CapabilitiesImpl.java | 42 + .../implementation/CapabilitiesInner.java | 217 ++ .../implementation/DatabaseImpl.java | 467 ++++ .../implementation/DatabaseInner.java | 723 ++++++ .../implementation/DatabaseOperationImpl.java | 117 + .../DatabaseOperationInner.java | 233 ++ .../DatabaseOperationsImpl.java | 61 + .../DatabaseOperationsInner.java | 417 +++ ...ulnerabilityAssessmentScansExportImpl.java | 46 + ...lnerabilityAssessmentScansExportInner.java | 36 + ...abaseVulnerabilityAssessmentScansImpl.java | 94 + ...baseVulnerabilityAssessmentScansInner.java | 717 ++++++ .../implementation/DatabasesImpl.java | 135 + .../implementation/DatabasesInner.java | 1862 ++++++++++++++ .../implementation/ElasticPoolImpl.java | 238 ++ .../implementation/ElasticPoolInner.java | 205 ++ .../ElasticPoolOperationImpl.java | 116 + .../ElasticPoolOperationInner.java | 231 ++ .../ElasticPoolOperationsImpl.java | 61 + .../ElasticPoolOperationsInner.java | 417 +++ .../implementation/ElasticPoolsImpl.java | 81 + .../implementation/ElasticPoolsInner.java | 1095 ++++++++ .../implementation/IdParsingUtils.java | 57 + .../InstanceFailoverGroupImpl.java | 154 ++ .../InstanceFailoverGroupInner.java | 161 ++ .../InstanceFailoverGroupsImpl.java | 105 + .../InstanceFailoverGroupsInner.java | 1134 +++++++++ .../LocationCapabilitiesImpl.java | 55 + .../LocationCapabilitiesInner.java | 108 + .../ManagedInstanceTdeCertificatesImpl.java | 34 + .../ManagedInstanceTdeCertificatesInner.java | 236 ++ .../implementation/PageImpl.java | 75 + .../SqlManagementClientImpl.java | 322 +++ .../implementation/SqlManager.java | 207 ++ .../implementation/TdeCertificateInner.java | 72 + .../implementation/TdeCertificatesImpl.java | 34 + .../implementation/TdeCertificatesInner.java | 236 ++ ...VulnerabilityAssessmentScanRecordImpl.java | 104 + ...ulnerabilityAssessmentScanRecordInner.java | 146 ++ .../implementation/package-info.java | 11 + .../sql/v2017_10_01_preview/package-info.java | 11 + 226 files changed, 37792 insertions(+) create mode 100644 sql/resource-manager/v2014_04_01/pom.xml create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AuthenticationType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityReason.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityRequest.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityResponse.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CreateMode.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Database.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseSecurityAlertPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseThreatDetectionPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPool.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivities.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivity.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivities.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivity.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolUpdate.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ExportRequest.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRule.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRules.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExportResponse.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExtensionRequest.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportRequest.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationImpact.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReadScale.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPool.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPoolMetric.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndex.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexAction.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLink.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLinks.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationRole.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SampleName.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyEmailAccountAdmins.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyUseServerDefault.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveName.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisor.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisors.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SloUsageMetric.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/StorageKeyType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryption.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivities.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivity.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivityStatus.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionStatus.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptions.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/PageImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/package-info.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/package-info.java create mode 100644 sql/resource-manager/v2017_10_01_preview/pom.xml create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicies.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicy.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Capabilities.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityGroup.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityStatus.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CatalogCollationType.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CreateMode.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Database.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseLicenseType.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperation.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperations.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseReadScale.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScansExport.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Databases.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/EditionCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPool.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolEditionCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolLicenseType.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperation.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperations.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseSettings.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerformanceLevelCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolState.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolUpdate.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPools.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroup.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadOnlyEndpoint.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadWriteEndpoint.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReplicationRole.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroups.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LicenseTypeCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LocationCapabilities.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeUnit.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEditionCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceFamilyCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstancePairInfo.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceTdeCertificates.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVcoresCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVersionCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagementOperationState.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeRangeCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeUnit.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PartnerRegionInfo.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelUnit.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadOnlyEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadWriteEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ResourceMoveDefinition.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/SampleName.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVersionCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServiceObjectiveCapability.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Sku.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/TdeCertificates.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanError.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanRecord.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanState.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanTriggerType.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/PageImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificateInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/package-info.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/package-info.java diff --git a/sql/resource-manager/v2014_04_01/pom.xml b/sql/resource-manager/v2014_04_01/pom.xml new file mode 100644 index 0000000000000..15ee9d56a144a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v2014_04_01 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AuthenticationType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AuthenticationType.java new file mode 100644 index 0000000000000..4612cd8dbdcb3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AuthenticationType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AuthenticationType. + */ +public enum AuthenticationType { + /** Enum value SQL. */ + SQL("SQL"), + + /** Enum value ADPassword. */ + ADPASSWORD("ADPassword"); + + /** The actual serialized value for a AuthenticationType instance. */ + private String value; + + AuthenticationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AuthenticationType instance. + * + * @param value the serialized value to parse. + * @return the parsed AuthenticationType object, or null if unable to parse. + */ + @JsonCreator + public static AuthenticationType fromString(String value) { + AuthenticationType[] items = AuthenticationType.values(); + for (AuthenticationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityReason.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..43ccfbe6df5d7 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityReason.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CheckNameAvailabilityReason. + */ +public enum CheckNameAvailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a CheckNameAvailabilityReason instance. */ + private String value; + + CheckNameAvailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CheckNameAvailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed CheckNameAvailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String value) { + CheckNameAvailabilityReason[] items = CheckNameAvailabilityReason.values(); + for (CheckNameAvailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..b47c0b0d7f75c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityRequest.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A request to check whether the specified name for a resource is available. + */ +public class CheckNameAvailabilityRequest { + /** + * The name whose availability is to be checked. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of resource that is used as the scope of the availability + * check. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + * @param name the name whose availability is to be checked. + */ + public CheckNameAvailabilityRequest() { + type = "Microsoft.Sql/servers"; + } + + /** + * Get the name whose availability is to be checked. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name whose availability is to be checked. + * + * @param name the name value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of resource that is used as the scope of the availability check. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of resource that is used as the scope of the availability check. + * + * @param type the type value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityResponse.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..46f0b0f742334 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityResponse.java @@ -0,0 +1,40 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.CheckNameAvailabilityResponseInner; + +/** + * Type representing CheckNameAvailabilityResponse. + */ +public interface CheckNameAvailabilityResponse extends HasInner, HasManager { + /** + * @return the available value. + */ + Boolean available(); + + /** + * @return the message value. + */ + String message(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CreateMode.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CreateMode.java new file mode 100644 index 0000000000000..3228ed0aeb77e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CreateMode.java @@ -0,0 +1,59 @@ +/** + * 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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CreateMode. + */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Copy for CreateMode. */ + public static final CreateMode COPY = fromString("Copy"); + + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value NonReadableSecondary for CreateMode. */ + public static final CreateMode NON_READABLE_SECONDARY = fromString("NonReadableSecondary"); + + /** Static value OnlineSecondary for CreateMode. */ + public static final CreateMode ONLINE_SECONDARY = fromString("OnlineSecondary"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Recovery for CreateMode. */ + public static final CreateMode RECOVERY = fromString("Recovery"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** Static value RestoreLongTermRetentionBackup for CreateMode. */ + public static final CreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** + * Creates or finds a CreateMode from its string representation. + * @param name a name to look for + * @return the corresponding CreateMode + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * @return known CreateMode values + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Database.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Database.java new file mode 100644 index 0000000000000..cbc104d416e0d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Database.java @@ -0,0 +1,546 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.Map; +import org.joda.time.DateTime; +import java.util.UUID; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionInner; + +/** + * Type representing Database. + */ +public interface Database extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the containmentState value. + */ + Long containmentState(); + + /** + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the currentServiceObjectiveId value. + */ + UUID currentServiceObjectiveId(); + + /** + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the edition value. + */ + DatabaseEdition edition(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeBytes value. + */ + String maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the readScale value. + */ + ReadScale readScale(); + + /** + * @return the recommendedIndex value. + */ + List recommendedIndex(); + + /** + * @return the recoveryServicesRecoveryPointResourceId value. + */ + String recoveryServicesRecoveryPointResourceId(); + + /** + * @return the requestedServiceObjectiveId value. + */ + UUID requestedServiceObjectiveId(); + + /** + * @return the requestedServiceObjectiveName value. + */ + ServiceObjectiveName requestedServiceObjectiveName(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * @return the serviceLevelObjective value. + */ + ServiceObjectiveName serviceLevelObjective(); + + /** + * @return the serviceTierAdvisors value. + */ + List serviceTierAdvisors(); + + /** + * @return the sourceDatabaseDeletionDate value. + */ + DateTime sourceDatabaseDeletionDate(); + + /** + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the transparentDataEncryption value. + */ + List transparentDataEncryption(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the Database definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Database definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Database definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the database definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the database definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the database definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the database definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database definition allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + WithCreate withEdition(DatabaseEdition edition); + } + + /** + * The stage of the database definition allowing to specify ElasticPoolName. + */ + interface WithElasticPoolName { + /** + * Specifies elasticPoolName. + */ + WithCreate withElasticPoolName(String elasticPoolName); + } + + /** + * The stage of the database definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(String maxSizeBytes); + } + + /** + * The stage of the database definition allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + WithCreate withReadScale(ReadScale readScale); + } + + /** + * The stage of the database definition allowing to specify RecoveryServicesRecoveryPointResourceId. + */ + interface WithRecoveryServicesRecoveryPointResourceId { + /** + * Specifies recoveryServicesRecoveryPointResourceId. + */ + WithCreate withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId); + } + + /** + * The stage of the database definition allowing to specify RequestedServiceObjectiveId. + */ + interface WithRequestedServiceObjectiveId { + /** + * Specifies requestedServiceObjectiveId. + */ + WithCreate withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId); + } + + /** + * The stage of the database definition allowing to specify RequestedServiceObjectiveName. + */ + interface WithRequestedServiceObjectiveName { + /** + * Specifies requestedServiceObjectiveName. + */ + WithCreate withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName); + } + + /** + * The stage of the database definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database definition allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + WithCreate withSampleName(SampleName sampleName); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + WithCreate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the database definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithEdition, DefinitionStages.WithElasticPoolName, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithReadScale, DefinitionStages.WithRecoveryServicesRecoveryPointResourceId, DefinitionStages.WithRequestedServiceObjectiveId, DefinitionStages.WithRequestedServiceObjectiveName, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a Database update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithEdition, UpdateStages.WithElasticPoolName, UpdateStages.WithMaxSizeBytes, UpdateStages.WithReadScale, UpdateStages.WithRecoveryServicesRecoveryPointResourceId, UpdateStages.WithRequestedServiceObjectiveId, UpdateStages.WithRequestedServiceObjectiveName, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of Database update stages. + */ + interface UpdateStages { + /** + * The stage of the database update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the database update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database update allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + Update withEdition(DatabaseEdition edition); + } + + /** + * The stage of the database update allowing to specify ElasticPoolName. + */ + interface WithElasticPoolName { + /** + * Specifies elasticPoolName. + */ + Update withElasticPoolName(String elasticPoolName); + } + + /** + * The stage of the database update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(String maxSizeBytes); + } + + /** + * The stage of the database update allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + Update withReadScale(ReadScale readScale); + } + + /** + * The stage of the database update allowing to specify RecoveryServicesRecoveryPointResourceId. + */ + interface WithRecoveryServicesRecoveryPointResourceId { + /** + * Specifies recoveryServicesRecoveryPointResourceId. + */ + Update withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId); + } + + /** + * The stage of the database update allowing to specify RequestedServiceObjectiveId. + */ + interface WithRequestedServiceObjectiveId { + /** + * Specifies requestedServiceObjectiveId. + */ + Update withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId); + } + + /** + * The stage of the database update allowing to specify RequestedServiceObjectiveName. + */ + interface WithRequestedServiceObjectiveName { + /** + * Specifies requestedServiceObjectiveName. + */ + Update withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName); + } + + /** + * The stage of the database update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database update allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + Update withSampleName(SampleName sampleName); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + Update withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the database update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java new file mode 100644 index 0000000000000..63a8ddfef7e6c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseEdition. + */ +public final class DatabaseEdition extends ExpandableStringEnum { + /** Static value Web for DatabaseEdition. */ + public static final DatabaseEdition WEB = fromString("Web"); + + /** Static value Business for DatabaseEdition. */ + public static final DatabaseEdition BUSINESS = fromString("Business"); + + /** Static value Basic for DatabaseEdition. */ + public static final DatabaseEdition BASIC = fromString("Basic"); + + /** Static value Standard for DatabaseEdition. */ + public static final DatabaseEdition STANDARD = fromString("Standard"); + + /** Static value Premium for DatabaseEdition. */ + public static final DatabaseEdition PREMIUM = fromString("Premium"); + + /** Static value PremiumRS for DatabaseEdition. */ + public static final DatabaseEdition PREMIUM_RS = fromString("PremiumRS"); + + /** Static value Free for DatabaseEdition. */ + public static final DatabaseEdition FREE = fromString("Free"); + + /** Static value Stretch for DatabaseEdition. */ + public static final DatabaseEdition STRETCH = fromString("Stretch"); + + /** Static value DataWarehouse for DatabaseEdition. */ + public static final DatabaseEdition DATA_WAREHOUSE = fromString("DataWarehouse"); + + /** Static value System for DatabaseEdition. */ + public static final DatabaseEdition SYSTEM = fromString("System"); + + /** Static value System2 for DatabaseEdition. */ + public static final DatabaseEdition SYSTEM2 = fromString("System2"); + + /** + * Creates or finds a DatabaseEdition from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseEdition + */ + @JsonCreator + public static DatabaseEdition fromString(String name) { + return fromString(name, DatabaseEdition.class); + } + + /** + * @return known DatabaseEdition values + */ + public static Collection values() { + return values(DatabaseEdition.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseSecurityAlertPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..219419e26a666 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseSecurityAlertPolicy.java @@ -0,0 +1,305 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing DatabaseSecurityAlertPolicy. + */ +public interface DatabaseSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the disabledAlerts value. + */ + String disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + String emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @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(); + + /** + * @return the useServerDefault value. + */ + SecurityAlertPolicyUseServerDefault useServerDefault(); + + /** + * 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. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(String disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(String emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + WithCreate withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + + /** + * 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.WithLocation, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint, DefinitionStages.WithUseServerDefault { + } + } + /** + * 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.WithLocation, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint, UpdateStages.WithUseServerDefault { + } + + /** + * Grouping of DatabaseSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databasesecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(String disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(String emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + Update withLocation(String location); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + Update withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseThreatDetectionPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseThreatDetectionPolicies.java new file mode 100644 index 0000000000000..a1094193ed710 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseThreatDetectionPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseThreatDetectionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseThreatDetectionPolicies. + */ +public interface DatabaseThreatDetectionPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's threat detection 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 database Threat Detection 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); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java new file mode 100644 index 0000000000000..2600459243381 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java @@ -0,0 +1,726 @@ +/** + * 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.v2014_04_01; + +import java.util.Map; +import org.joda.time.DateTime; +import java.util.UUID; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database update. + */ +@JsonFlatten +public class DatabaseUpdate extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The collation of the database. If createMode is not Default, this value + * is ignored. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The containment state of the database. + */ + @JsonProperty(value = "properties.containmentState", access = JsonProperty.Access.WRITE_ONLY) + private Long containmentState; + + /** + * The current service level objective ID of the database. This is the ID + * of the service level objective that is currently active. + */ + @JsonProperty(value = "properties.currentServiceObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceObjectiveId; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * OnlineSecondary/NonReadableSecondary: creates a database as a (readable + * or nonreadable) secondary replica of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing + * primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, NonReadableSecondary, OnlineSecondary and + * RestoreLongTermRetentionBackup are not supported for DataWarehouse + * edition. Possible values include: 'Copy', 'Default', + * 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', + * 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * Conditional. If createMode is Copy, NonReadableSecondary, + * OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this + * value is required. Specifies the resource ID of the source database. If + * createMode is NonReadableSecondary or OnlineSecondary, the name of the + * source database must be the same as the new database being created. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * Conditional. If createMode is Restore and sourceDatabaseId is the + * deleted database's original resource id when it existed (as opposed to + * its current restorable dropped database id), then this value is + * required. Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. If createMode is Restore, this value is optional. Specifies + * the point in time (ISO8601 format) of the source database that will be + * restored to create the new database. Must be greater than or equal to + * the source database's earliestRestoreDate value. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Conditional. If createMode is RestoreLongTermRetentionBackup, then this + * value is required. Specifies the resource ID of the recovery point to + * restore from. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointResourceId") + private String recoveryServicesRecoveryPointResourceId; + + /** + * The edition of the database. The DatabaseEditions enumeration contains + * all the valid editions. If createMode is NonReadableSecondary or + * OnlineSecondary, this value is ignored. To see possible values, query + * the capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions -l westus --query [].name`. + * Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2'. + */ + @JsonProperty(value = "properties.edition") + private DatabaseEdition edition; + + /** + * The max size of the database expressed in bytes. If createMode is not + * Default, this value is ignored. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation.". + */ + @JsonProperty(value = "properties.maxSizeBytes") + private String maxSizeBytes; + + /** + * The configured service level objective ID of the database. This is the + * service level objective that is in the process of being applied to the + * database. Once successfully updated, it will match the value of + * currentServiceObjectiveId property. If requestedServiceObjectiveId and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveId overrides the value of + * requestedServiceObjectiveName. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name` . + */ + @JsonProperty(value = "properties.requestedServiceObjectiveId") + private UUID requestedServiceObjectiveId; + + /** + * The name of the configured service level objective of the database. This + * is the service level objective that is in the process of being applied + * to the database. Once successfully updated, it will match the value of + * serviceLevelObjective property. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name`. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName") + private ServiceObjectiveName requestedServiceObjectiveName; + + /** + * The current service level objective of the database. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /** + * The status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The name of the elastic pool the database is in. If elasticPoolName and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveName is ignored. Not supported for + * DataWarehouse edition. + */ + @JsonProperty(value = "properties.elasticPoolName") + private String elasticPoolName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * The list of service tier advisors for this database. Expanded property. + */ + @JsonProperty(value = "properties.serviceTierAdvisors", access = JsonProperty.Access.WRITE_ONLY) + private List serviceTierAdvisors; + + /** + * The transparent data encryption info for this database. + */ + @JsonProperty(value = "properties.transparentDataEncryption", access = JsonProperty.Access.WRITE_ONLY) + private List transparentDataEncryption; + + /** + * The recommended indices for this database. + */ + @JsonProperty(value = "properties.recommendedIndex", access = JsonProperty.Access.WRITE_ONLY) + private List recommendedIndex; + + /** + * The resource identifier of the failover group containing this database. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Conditional. If the database is a geo-secondary, readScale indicates + * whether read-only connections are allowed to this database or not. Not + * supported for DataWarehouse edition. Possible values include: 'Enabled', + * 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private ReadScale readScale; + + /** + * Indicates the name of the sample schema to apply when creating this + * database. If createMode is not Default, this value is ignored. Not + * supported for DataWarehouse edition. Possible values include: + * 'AdventureWorksLT'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the collation of the database. If createMode is not Default, this value is ignored. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. If createMode is not Default, this value is ignored. + * + * @param collation the collation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the containment state of the database. + * + * @return the containmentState value + */ + public Long containmentState() { + return this.containmentState; + } + + /** + * Get the current service level objective ID of the database. This is the ID of the service level objective that is currently active. + * + * @return the currentServiceObjectiveId value + */ + public UUID currentServiceObjectiveId() { + return this.currentServiceObjectiveId; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @return the recoveryServicesRecoveryPointResourceId value + */ + public String recoveryServicesRecoveryPointResourceId() { + return this.recoveryServicesRecoveryPointResourceId; + } + + /** + * Set conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @param recoveryServicesRecoveryPointResourceId the recoveryServicesRecoveryPointResourceId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId) { + this.recoveryServicesRecoveryPointResourceId = recoveryServicesRecoveryPointResourceId; + return this; + } + + /** + * Get the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @param edition the edition value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @return the requestedServiceObjectiveId value + */ + public UUID requestedServiceObjectiveId() { + return this.requestedServiceObjectiveId; + } + + /** + * Set the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @param requestedServiceObjectiveId the requestedServiceObjectiveId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId) { + this.requestedServiceObjectiveId = requestedServiceObjectiveId; + return this; + } + + /** + * Get the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the requestedServiceObjectiveName value + */ + public ServiceObjectiveName requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Set the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @param requestedServiceObjectiveName the requestedServiceObjectiveName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName) { + this.requestedServiceObjectiveName = requestedServiceObjectiveName; + return this; + } + + /** + * Get the current service level objective of the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceLevelObjective value + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the status of the database. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the list of service tier advisors for this database. Expanded property. + * + * @return the serviceTierAdvisors value + */ + public List serviceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** + * Get the transparent data encryption info for this database. + * + * @return the transparentDataEncryption value + */ + public List transparentDataEncryption() { + return this.transparentDataEncryption; + } + + /** + * Get the recommended indices for this database. + * + * @return the recommendedIndex value + */ + public List recommendedIndex() { + return this.recommendedIndex; + } + + /** + * Get the resource identifier of the failover group containing this database. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public ReadScale readScale() { + return this.readScale; + } + + /** + * Set conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(ReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java new file mode 100644 index 0000000000000..422206f42f8e1 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Databases. + */ +public interface Databases extends SupportsCreating, HasInner { + /** + * Begins definition for a new Extension resource. + * @param name resource name. + * @return the first stage of the new Extension definition. + */ + ImportExportResponse.DefinitionStages.Blank defineExtension(String name); + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable pauseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable resumeAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database inside of 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 be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName); + + /** + * Returns a list of databases in 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets a database inside of a recommented 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName); + + /** + * Returns a list of databases inside a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters); + + /** + * Gets 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns a list of databases in 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(String resourceGroupName, String serverName); + + /** + * Deletes 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 be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPool.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPool.java new file mode 100644 index 0000000000000..3d1ce6a7f16dd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPool.java @@ -0,0 +1,292 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPool. + */ +public interface ElasticPool extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the databaseDtuMax value. + */ + Integer databaseDtuMax(); + + /** + * @return the databaseDtuMin value. + */ + Integer databaseDtuMin(); + + /** + * @return the dtu value. + */ + Integer dtu(); + + /** + * @return the edition value. + */ + ElasticPoolEdition edition(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + ElasticPoolState state(); + + /** + * @return the storageMB value. + */ + Integer storageMB(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the ElasticPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ElasticPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ElasticPool definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the elasticpool definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the elasticpool definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the elasticpool definition allowing to specify DatabaseDtuMax. + */ + interface WithDatabaseDtuMax { + /** + * Specifies databaseDtuMax. + */ + WithCreate withDatabaseDtuMax(Integer databaseDtuMax); + } + + /** + * The stage of the elasticpool definition allowing to specify DatabaseDtuMin. + */ + interface WithDatabaseDtuMin { + /** + * Specifies databaseDtuMin. + */ + WithCreate withDatabaseDtuMin(Integer databaseDtuMin); + } + + /** + * The stage of the elasticpool definition allowing to specify Dtu. + */ + interface WithDtu { + /** + * Specifies dtu. + */ + WithCreate withDtu(Integer dtu); + } + + /** + * The stage of the elasticpool definition allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + WithCreate withEdition(ElasticPoolEdition edition); + } + + /** + * The stage of the elasticpool definition allowing to specify StorageMB. + */ + interface WithStorageMB { + /** + * Specifies storageMB. + */ + WithCreate withStorageMB(Integer storageMB); + } + + /** + * The stage of the elasticpool definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the elasticpool definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithDatabaseDtuMax, DefinitionStages.WithDatabaseDtuMin, DefinitionStages.WithDtu, DefinitionStages.WithEdition, DefinitionStages.WithStorageMB, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a ElasticPool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDatabaseDtuMax, UpdateStages.WithDatabaseDtuMin, UpdateStages.WithDtu, UpdateStages.WithEdition, UpdateStages.WithStorageMB, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of ElasticPool update stages. + */ + interface UpdateStages { + /** + * The stage of the elasticpool update allowing to specify DatabaseDtuMax. + */ + interface WithDatabaseDtuMax { + /** + * Specifies databaseDtuMax. + */ + Update withDatabaseDtuMax(Integer databaseDtuMax); + } + + /** + * The stage of the elasticpool update allowing to specify DatabaseDtuMin. + */ + interface WithDatabaseDtuMin { + /** + * Specifies databaseDtuMin. + */ + Update withDatabaseDtuMin(Integer databaseDtuMin); + } + + /** + * The stage of the elasticpool update allowing to specify Dtu. + */ + interface WithDtu { + /** + * Specifies dtu. + */ + Update withDtu(Integer dtu); + } + + /** + * The stage of the elasticpool update allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + Update withEdition(ElasticPoolEdition edition); + } + + /** + * The stage of the elasticpool update allowing to specify StorageMB. + */ + interface WithStorageMB { + /** + * Specifies storageMB. + */ + Update withStorageMB(Integer storageMB); + } + + /** + * The stage of the elasticpool update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the elasticpool update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivities.java new file mode 100644 index 0000000000000..28970d3a05d32 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivities.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolActivities. + */ +public interface ElasticPoolActivities extends HasInner { + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivity.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivity.java new file mode 100644 index 0000000000000..310b97986c586 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivity.java @@ -0,0 +1,142 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolActivityInner; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ElasticPoolActivity. + */ +public interface ElasticPoolActivity extends HasInner, HasManager { + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationId value. + */ + UUID operationId(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the requestedDatabaseDtuCap value. + */ + Integer requestedDatabaseDtuCap(); + + /** + * @return the requestedDatabaseDtuGuarantee value. + */ + Integer requestedDatabaseDtuGuarantee(); + + /** + * @return the requestedDatabaseDtuMax value. + */ + Integer requestedDatabaseDtuMax(); + + /** + * @return the requestedDatabaseDtuMin value. + */ + Integer requestedDatabaseDtuMin(); + + /** + * @return the requestedDtu value. + */ + Integer requestedDtu(); + + /** + * @return the requestedDtuGuarantee value. + */ + Integer requestedDtuGuarantee(); + + /** + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * @return the requestedStorageLimitInGB value. + */ + Long requestedStorageLimitInGB(); + + /** + * @return the requestedStorageLimitInMB value. + */ + Integer requestedStorageLimitInMB(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivities.java new file mode 100644 index 0000000000000..8ddbf8097bcd3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivities.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolDatabaseActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolDatabaseActivities. + */ +public interface ElasticPoolDatabaseActivities extends HasInner { + /** + * Returns activity on databases inside of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivity.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivity.java new file mode 100644 index 0000000000000..e5d68d036bc0a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivity.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolDatabaseActivityInner; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ElasticPoolDatabaseActivity. + */ +public interface ElasticPoolDatabaseActivity extends HasInner, HasManager { + /** + * @return the currentElasticPoolName value. + */ + String currentElasticPoolName(); + + /** + * @return the currentServiceObjective value. + */ + String currentServiceObjective(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationId value. + */ + UUID operationId(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * @return the requestedServiceObjective value. + */ + String requestedServiceObjective(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java new file mode 100644 index 0000000000000..842f33fc97867 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolEdition. + */ +public final class ElasticPoolEdition extends ExpandableStringEnum { + /** Static value Basic for ElasticPoolEdition. */ + public static final ElasticPoolEdition BASIC = fromString("Basic"); + + /** Static value Standard for ElasticPoolEdition. */ + public static final ElasticPoolEdition STANDARD = fromString("Standard"); + + /** Static value Premium for ElasticPoolEdition. */ + public static final ElasticPoolEdition PREMIUM = fromString("Premium"); + + /** + * Creates or finds a ElasticPoolEdition from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolEdition + */ + @JsonCreator + public static ElasticPoolEdition fromString(String name) { + return fromString(name, ElasticPoolEdition.class); + } + + /** + * @return known ElasticPoolEdition values + */ + public static Collection values() { + return values(ElasticPoolEdition.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolState.java new file mode 100644 index 0000000000000..554a6fb93402e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolState.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolState. + */ +public final class ElasticPoolState extends ExpandableStringEnum { + /** Static value Creating for ElasticPoolState. */ + public static final ElasticPoolState CREATING = fromString("Creating"); + + /** Static value Ready for ElasticPoolState. */ + public static final ElasticPoolState READY = fromString("Ready"); + + /** Static value Disabled for ElasticPoolState. */ + public static final ElasticPoolState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ElasticPoolState from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolState + */ + @JsonCreator + public static ElasticPoolState fromString(String name) { + return fromString(name, ElasticPoolState.class); + } + + /** + * @return known ElasticPoolState values + */ + public static Collection values() { + return values(ElasticPoolState.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolUpdate.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolUpdate.java new file mode 100644 index 0000000000000..ecefd193f0ecc --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolUpdate.java @@ -0,0 +1,238 @@ +/** + * 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.v2014_04_01; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents an elastic pool update. + */ +@JsonFlatten +public class ElasticPoolUpdate extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The state of the elastic pool. Possible values include: 'Creating', + * 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /** + * The edition of the elastic pool. Possible values include: 'Basic', + * 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.edition") + private ElasticPoolEdition edition; + + /** + * The total shared DTU for the database elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Integer dtu; + + /** + * The maximum DTU any one database can consume. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Integer databaseDtuMax; + + /** + * The minimum DTU all databases are guaranteed. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Integer databaseDtuMin; + + /** + * Gets storage limit for the database elastic pool in MB. + */ + @JsonProperty(value = "properties.storageMB") + private Integer storageMB; + + /** + * Whether or not this database elastic pool is zone redundant, which means + * the replicas of this database will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * 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 ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled'. + * + * @return the state value + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the edition value + */ + public ElasticPoolEdition edition() { + return this.edition; + } + + /** + * Set the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @param edition the edition value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withEdition(ElasticPoolEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the total shared DTU for the database elastic pool. + * + * @return the dtu value + */ + public Integer dtu() { + return this.dtu; + } + + /** + * Set the total shared DTU for the database elastic pool. + * + * @param dtu the dtu value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withDtu(Integer dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the maximum DTU any one database can consume. + * + * @return the databaseDtuMax value + */ + public Integer databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the maximum DTU any one database can consume. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withDatabaseDtuMax(Integer databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get the minimum DTU all databases are guaranteed. + * + * @return the databaseDtuMin value + */ + public Integer databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the minimum DTU all databases are guaranteed. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withDatabaseDtuMin(Integer databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get gets storage limit for the database elastic pool in MB. + * + * @return the storageMB value + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set gets storage limit for the database elastic pool in MB. + * + * @param storageMB the storageMB value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java new file mode 100644 index 0000000000000..31fb76a3a1b0a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPools. + */ +public interface ElasticPools extends SupportsCreating, HasInner { + /** + * Gets 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns a list of elastic pools in 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(String resourceGroupName, String serverName); + + /** + * Deletes the 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 be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ExportRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ExportRequest.java new file mode 100644 index 0000000000000..38754c437f199 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ExportRequest.java @@ -0,0 +1,175 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Export database parameters. + */ +public class ExportRequest { + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /** + * Get the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @param storageKeyType the storageKeyType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @param storageKey the storageKey value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storage uri to use. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storage uri to use. + * + * @param storageUri the storageUri value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the name of the SQL administrator. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the name of the SQL administrator. + * + * @param administratorLogin the administratorLogin value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the password of the SQL administrator. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the password of the SQL administrator. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @param authenticationType the authenticationType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRule.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRule.java new file mode 100644 index 0000000000000..113a3fd162b70 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRule.java @@ -0,0 +1,125 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.FirewallRuleInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing FirewallRule. + */ +public interface FirewallRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FirewallRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithEndIpAddress, DefinitionStages.WithStartIpAddress, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallRule definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the firewallrule definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithEndIpAddress withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the firewallrule definition allowing to specify EndIpAddress. + */ + interface WithEndIpAddress { + /** + * Specifies endIpAddress. + */ + WithStartIpAddress withEndIpAddress(String endIpAddress); + } + + /** + * The stage of the firewallrule definition allowing to specify StartIpAddress. + */ + interface WithStartIpAddress { + /** + * Specifies startIpAddress. + */ + WithCreate withStartIpAddress(String startIpAddress); + } + + /** + * 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 { + } + } + /** + * The template for a FirewallRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of FirewallRule update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRules.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRules.java new file mode 100644 index 0000000000000..2d064a5027ace --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRules.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.FirewallRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallRules. + */ +public interface FirewallRules extends SupportsCreating, HasInner { + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExportResponse.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExportResponse.java new file mode 100644 index 0000000000000..3bfb29fdd51d3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExportResponse.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ImportExportResponseInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing ImportExportResponse. + */ +public interface ImportExportResponse extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the blobUri value. + */ + String blobUri(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the queuedTime value. + */ + String queuedTime(); + + /** + * @return the requestId value. + */ + UUID requestId(); + + /** + * @return the requestType value. + */ + String requestType(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ImportExportResponse definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithOperationMode, DefinitionStages.WithStorageKey, DefinitionStages.WithStorageKeyType, DefinitionStages.WithStorageUri, DefinitionStages.WithCreate { + } + + /** + * Grouping of ImportExportResponse definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ImportExportResponse definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the importexportresponse definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithAdministratorLogin withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the importexportresponse definition allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithAdministratorLoginPassword withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the importexportresponse definition allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithOperationMode withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the importexportresponse definition allowing to specify OperationMode. + */ + interface WithOperationMode { + /** + * Specifies operationMode. + */ + WithStorageKey withOperationMode(String operationMode); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageKey. + */ + interface WithStorageKey { + /** + * Specifies storageKey. + */ + WithStorageKeyType withStorageKey(String storageKey); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageKeyType. + */ + interface WithStorageKeyType { + /** + * Specifies storageKeyType. + */ + WithStorageUri withStorageKeyType(StorageKeyType storageKeyType); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageUri. + */ + interface WithStorageUri { + /** + * Specifies storageUri. + */ + WithCreate withStorageUri(String storageUri); + } + + /** + * The stage of the importexportresponse definition allowing to specify AuthenticationType. + */ + interface WithAuthenticationType { + /** + * Specifies authenticationType. + */ + WithCreate withAuthenticationType(AuthenticationType authenticationType); + } + + /** + * The stage of the importexportresponse definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + */ + WithCreate withName(String name); + } + + /** + * The stage of the importexportresponse definition allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + */ + WithCreate withType(String type); + } + + /** + * 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.WithAuthenticationType, DefinitionStages.WithName, DefinitionStages.WithType { + } + } + /** + * The template for a ImportExportResponse update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuthenticationType, UpdateStages.WithName, UpdateStages.WithType { + } + + /** + * Grouping of ImportExportResponse update stages. + */ + interface UpdateStages { + /** + * The stage of the importexportresponse update allowing to specify AuthenticationType. + */ + interface WithAuthenticationType { + /** + * Specifies authenticationType. + */ + Update withAuthenticationType(AuthenticationType authenticationType); + } + + /** + * The stage of the importexportresponse update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + */ + Update withName(String name); + } + + /** + * The stage of the importexportresponse update allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + */ + Update withType(String type); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExtensionRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExtensionRequest.java new file mode 100644 index 0000000000000..c3b0b7d5a3bee --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExtensionRequest.java @@ -0,0 +1,267 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Import database parameters. + */ +@JsonFlatten +public class ImportExtensionRequest { + /** + * The name of the extension. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The type of the extension. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "properties.storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "properties.storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "properties.storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "properties.authenticationType") + private AuthenticationType authenticationType; + + /** + * The type of import operation being performed. This is always Import. + */ + @JsonProperty(value = "properties.operationMode", required = true) + private String operationMode; + + /** + * Creates an instance of ImportExtensionRequest class. + * @param storageKeyType the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * @param storageKey the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * @param storageUri the storage uri to use. + * @param administratorLogin the name of the SQL administrator. + * @param administratorLoginPassword the password of the SQL administrator. + */ + public ImportExtensionRequest() { + operationMode = "Import"; + } + + /** + * Get the name of the extension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the extension. + * + * @param name the name value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of the extension. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the extension. + * + * @param type the type value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Get the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @param storageKeyType the storageKeyType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @param storageKey the storageKey value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storage uri to use. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storage uri to use. + * + * @param storageUri the storageUri value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the name of the SQL administrator. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the name of the SQL administrator. + * + * @param administratorLogin the administratorLogin value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the password of the SQL administrator. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the password of the SQL administrator. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @param authenticationType the authenticationType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the type of import operation being performed. This is always Import. + * + * @return the operationMode value + */ + public String operationMode() { + return this.operationMode; + } + + /** + * Set the type of import operation being performed. This is always Import. + * + * @param operationMode the operationMode value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withOperationMode(String operationMode) { + this.operationMode = operationMode; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportRequest.java new file mode 100644 index 0000000000000..f947a3473e506 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportRequest.java @@ -0,0 +1,132 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Import database parameters. + */ +public class ImportRequest extends ExportRequest { + /** + * The name of the database to import. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * The edition for the database being created. Possible values include: + * 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', + * 'Stretch', 'DataWarehouse', 'System', 'System2'. + */ + @JsonProperty(value = "edition", required = true) + private DatabaseEdition edition; + + /** + * The name of the service objective to assign to the database. Possible + * values include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "serviceObjectiveName", required = true) + private ServiceObjectiveName serviceObjectiveName; + + /** + * The maximum size for the newly imported database. + */ + @JsonProperty(value = "maxSizeBytes", required = true) + private String maxSizeBytes; + + /** + * Get the name of the database to import. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the name of the database to import. + * + * @param databaseName the databaseName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the edition for the database being created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition for the database being created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @param edition the edition value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the name of the service objective to assign to the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceObjectiveName value + */ + public ServiceObjectiveName serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Set the name of the service objective to assign to the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @param serviceObjectiveName the serviceObjectiveName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withServiceObjectiveName(ServiceObjectiveName serviceObjectiveName) { + this.serviceObjectiveName = serviceObjectiveName; + return this; + } + + /** + * Get the maximum size for the newly imported database. + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maximum size for the newly imported database. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationImpact.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationImpact.java new file mode 100644 index 0000000000000..89a77c9d80176 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationImpact.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. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The impact of an operation, both in absolute and relative terms. + */ +public class OperationImpact { + /** + * The name of the impact dimension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The unit in which estimated impact to dimension is measured. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The absolute impact to dimension. + */ + @JsonProperty(value = "changeValueAbsolute", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueAbsolute; + + /** + * The relative impact to dimension (null if not applicable). + */ + @JsonProperty(value = "changeValueRelative", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueRelative; + + /** + * Get the name of the impact dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the unit in which estimated impact to dimension is measured. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the absolute impact to dimension. + * + * @return the changeValueAbsolute value + */ + public Double changeValueAbsolute() { + return this.changeValueAbsolute; + } + + /** + * Get the relative impact to dimension (null if not applicable). + * + * @return the changeValueRelative value + */ + public Double changeValueRelative() { + return this.changeValueRelative; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReadScale.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReadScale.java new file mode 100644 index 0000000000000..9547b48f8d2e6 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReadScale.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReadScale. + */ +public enum ReadScale { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReadScale instance. */ + private String value; + + ReadScale(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReadScale instance. + * + * @param value the serialized value to parse. + * @return the parsed ReadScale object, or null if unable to parse. + */ + @JsonCreator + public static ReadScale fromString(String value) { + ReadScale[] items = ReadScale.values(); + for (ReadScale item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPool.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPool.java new file mode 100644 index 0000000000000..18fedbd6be7c9 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPool.java @@ -0,0 +1,94 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecommendedElasticPoolInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing RecommendedElasticPool. + */ +public interface RecommendedElasticPool extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the databaseDtuMax value. + */ + Double databaseDtuMax(); + + /** + * @return the databaseDtuMin value. + */ + Double databaseDtuMin(); + + /** + * @return the databaseEdition value. + */ + ElasticPoolEdition databaseEdition(); + + /** + * @return the databases value. + */ + List databases(); + + /** + * @return the dtu value. + */ + Double dtu(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxObservedDtu value. + */ + Double maxObservedDtu(); + + /** + * @return the maxObservedStorageMB value. + */ + Double maxObservedStorageMB(); + + /** + * @return the metrics value. + */ + List metrics(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the observationPeriodEnd value. + */ + DateTime observationPeriodEnd(); + + /** + * @return the observationPeriodStart value. + */ + DateTime observationPeriodStart(); + + /** + * @return the storageMB value. + */ + Double storageMB(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPoolMetric.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPoolMetric.java new file mode 100644 index 0000000000000..a0a76f2b36dba --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPoolMetric.java @@ -0,0 +1,36 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecommendedElasticPoolMetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RecommendedElasticPoolMetric. + */ +public interface RecommendedElasticPoolMetric extends HasInner, HasManager { + /** + * @return the dateTimeProperty value. + */ + DateTime dateTimeProperty(); + + /** + * @return the dtu value. + */ + Double dtu(); + + /** + * @return the sizeGB value. + */ + Double sizeGB(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java new file mode 100644 index 0000000000000..cc8cc11b6c8c2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java @@ -0,0 +1,52 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecommendedElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; + +/** + * Type representing RecommendedElasticPools. + */ +public interface RecommendedElasticPools extends HasInner { + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndex.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndex.java new file mode 100644 index 0000000000000..09698ba74e2f4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndex.java @@ -0,0 +1,210 @@ +/** + * 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.v2014_04_01; + +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; + +/** + * Represents a database recommended index. + */ +@JsonFlatten +public class RecommendedIndex extends ProxyResource { + /** + * The proposed index action. You can create a missing index, drop an + * unused index, or rebuild an existing index to improve its performance. + * Possible values include: 'Create', 'Drop', 'Rebuild'. + */ + @JsonProperty(value = "properties.action", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexAction action; + + /** + * The current recommendation state. Possible values include: 'Active', + * 'Pending', 'Executing', 'Verifying', 'Pending Revert', 'Reverting', + * 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexState state; + + /** + * The UTC datetime showing when this resource was created (ISO8601 + * format). + */ + @JsonProperty(value = "properties.created", access = JsonProperty.Access.WRITE_ONLY) + private DateTime created; + + /** + * The UTC datetime of when was this resource last changed (ISO8601 + * format). + */ + @JsonProperty(value = "properties.lastModified", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModified; + + /** + * The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED + * COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', + * 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE'. + */ + @JsonProperty(value = "properties.indexType", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexType indexType; + + /** + * The schema where table to build index over resides. + */ + @JsonProperty(value = "properties.schema", access = JsonProperty.Access.WRITE_ONLY) + private String schema; + + /** + * The table on which to build index. + */ + @JsonProperty(value = "properties.table", access = JsonProperty.Access.WRITE_ONLY) + private String table; + + /** + * Columns over which to build index. + */ + @JsonProperty(value = "properties.columns", access = JsonProperty.Access.WRITE_ONLY) + private List columns; + + /** + * The list of column names to be included in the index. + */ + @JsonProperty(value = "properties.includedColumns", access = JsonProperty.Access.WRITE_ONLY) + private List includedColumns; + + /** + * The full build index script. + */ + @JsonProperty(value = "properties.indexScript", access = JsonProperty.Access.WRITE_ONLY) + private String indexScript; + + /** + * The estimated impact of doing recommended index action. + */ + @JsonProperty(value = "properties.estimatedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List estimatedImpact; + + /** + * The values reported after index action is complete. + */ + @JsonProperty(value = "properties.reportedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List reportedImpact; + + /** + * Get the proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild'. + * + * @return the action value + */ + public RecommendedIndexAction action() { + return this.action; + } + + /** + * Get the current recommendation state. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success'. + * + * @return the state value + */ + public RecommendedIndexState state() { + return this.state; + } + + /** + * Get the UTC datetime showing when this resource was created (ISO8601 format). + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Get the UTC datetime of when was this resource last changed (ISO8601 format). + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Get the type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE'. + * + * @return the indexType value + */ + public RecommendedIndexType indexType() { + return this.indexType; + } + + /** + * Get the schema where table to build index over resides. + * + * @return the schema value + */ + public String schema() { + return this.schema; + } + + /** + * Get the table on which to build index. + * + * @return the table value + */ + public String table() { + return this.table; + } + + /** + * Get columns over which to build index. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Get the list of column names to be included in the index. + * + * @return the includedColumns value + */ + public List includedColumns() { + return this.includedColumns; + } + + /** + * Get the full build index script. + * + * @return the indexScript value + */ + public String indexScript() { + return this.indexScript; + } + + /** + * Get the estimated impact of doing recommended index action. + * + * @return the estimatedImpact value + */ + public List estimatedImpact() { + return this.estimatedImpact; + } + + /** + * Get the values reported after index action is complete. + * + * @return the reportedImpact value + */ + public List reportedImpact() { + return this.reportedImpact; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexAction.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexAction.java new file mode 100644 index 0000000000000..eb379d9810132 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexAction.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexAction. + */ +public enum RecommendedIndexAction { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Drop. */ + DROP("Drop"), + + /** Enum value Rebuild. */ + REBUILD("Rebuild"); + + /** The actual serialized value for a RecommendedIndexAction instance. */ + private String value; + + RecommendedIndexAction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexAction instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexAction object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexAction fromString(String value) { + RecommendedIndexAction[] items = RecommendedIndexAction.values(); + for (RecommendedIndexAction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexState.java new file mode 100644 index 0000000000000..202ced229428a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexState.java @@ -0,0 +1,80 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexState. + */ +public enum RecommendedIndexState { + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Pending. */ + PENDING("Pending"), + + /** Enum value Executing. */ + EXECUTING("Executing"), + + /** Enum value Verifying. */ + VERIFYING("Verifying"), + + /** Enum value Pending Revert. */ + PENDING_REVERT("Pending Revert"), + + /** Enum value Reverting. */ + REVERTING("Reverting"), + + /** Enum value Reverted. */ + REVERTED("Reverted"), + + /** Enum value Ignored. */ + IGNORED("Ignored"), + + /** Enum value Expired. */ + EXPIRED("Expired"), + + /** Enum value Blocked. */ + BLOCKED("Blocked"), + + /** Enum value Success. */ + SUCCESS("Success"); + + /** The actual serialized value for a RecommendedIndexState instance. */ + private String value; + + RecommendedIndexState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexState instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexState object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexState fromString(String value) { + RecommendedIndexState[] items = RecommendedIndexState.values(); + for (RecommendedIndexState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexType.java new file mode 100644 index 0000000000000..96c26210017f0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexType.java @@ -0,0 +1,59 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexType. + */ +public enum RecommendedIndexType { + /** Enum value CLUSTERED. */ + CLUSTERED("CLUSTERED"), + + /** Enum value NONCLUSTERED. */ + NONCLUSTERED("NONCLUSTERED"), + + /** Enum value COLUMNSTORE. */ + COLUMNSTORE("COLUMNSTORE"), + + /** Enum value CLUSTERED COLUMNSTORE. */ + CLUSTERED_COLUMNSTORE("CLUSTERED COLUMNSTORE"); + + /** The actual serialized value for a RecommendedIndexType instance. */ + private String value; + + RecommendedIndexType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexType instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexType object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexType fromString(String value) { + RecommendedIndexType[] items = RecommendedIndexType.values(); + for (RecommendedIndexType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLink.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLink.java new file mode 100644 index 0000000000000..d94da2e11d759 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLink.java @@ -0,0 +1,93 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ReplicationLinkInner; +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.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ReplicationLink. + */ +public interface ReplicationLink extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the isTerminationAllowed value. + */ + Boolean isTerminationAllowed(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerDatabase value. + */ + String partnerDatabase(); + + /** + * @return the partnerLocation value. + */ + String partnerLocation(); + + /** + * @return the partnerRole value. + */ + ReplicationRole partnerRole(); + + /** + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the replicationMode value. + */ + String replicationMode(); + + /** + * @return the replicationState value. + */ + ReplicationState replicationState(); + + /** + * @return the role value. + */ + ReplicationRole role(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLinks.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLinks.java new file mode 100644 index 0000000000000..2e025e123a389 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLinks.java @@ -0,0 +1,79 @@ +/** + * 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.v2014_04_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ReplicationLinksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReplicationLinks. + */ +public interface ReplicationLinks extends HasInner { + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationRole.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationRole.java new file mode 100644 index 0000000000000..114bffe1c23bd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationRole.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReplicationRole. + */ +public enum ReplicationRole { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"), + + /** Enum value NonReadableSecondary. */ + NON_READABLE_SECONDARY("NonReadableSecondary"), + + /** Enum value Source. */ + SOURCE("Source"), + + /** Enum value Copy. */ + COPY("Copy"); + + /** The actual serialized value for a ReplicationRole instance. */ + private String value; + + ReplicationRole(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReplicationRole instance. + * + * @param value the serialized value to parse. + * @return the parsed ReplicationRole object, or null if unable to parse. + */ + @JsonCreator + public static ReplicationRole fromString(String value) { + ReplicationRole[] items = ReplicationRole.values(); + for (ReplicationRole item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationState.java new file mode 100644 index 0000000000000..0a31a15d4d9d6 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationState.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReplicationState. + */ +public final class ReplicationState extends ExpandableStringEnum { + /** Static value PENDING for ReplicationState. */ + public static final ReplicationState PENDING = fromString("PENDING"); + + /** Static value SEEDING for ReplicationState. */ + public static final ReplicationState SEEDING = fromString("SEEDING"); + + /** Static value CATCH_UP for ReplicationState. */ + public static final ReplicationState CATCH_UP = fromString("CATCH_UP"); + + /** Static value SUSPENDED for ReplicationState. */ + public static final ReplicationState SUSPENDED = fromString("SUSPENDED"); + + /** + * Creates or finds a ReplicationState from its string representation. + * @param name a name to look for + * @return the corresponding ReplicationState + */ + @JsonCreator + public static ReplicationState fromString(String name) { + return fromString(name, ReplicationState.class); + } + + /** + * @return known ReplicationState values + */ + public static Collection values() { + return values(ReplicationState.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SampleName.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SampleName.java new file mode 100644 index 0000000000000..0233430fdec2d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SampleName.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SampleName. + */ +public final class SampleName extends ExpandableStringEnum { + /** Static value AdventureWorksLT for SampleName. */ + public static final SampleName ADVENTURE_WORKS_LT = fromString("AdventureWorksLT"); + + /** + * Creates or finds a SampleName from its string representation. + * @param name a name to look for + * @return the corresponding SampleName + */ + @JsonCreator + public static SampleName fromString(String name) { + return fromString(name, SampleName.class); + } + + /** + * @return known SampleName values + */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyEmailAccountAdmins.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyEmailAccountAdmins.java new file mode 100644 index 0000000000000..2ae0a9a487f18 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyEmailAccountAdmins.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyEmailAccountAdmins. + */ +public enum SecurityAlertPolicyEmailAccountAdmins { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyEmailAccountAdmins instance. */ + private String value; + + SecurityAlertPolicyEmailAccountAdmins(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyEmailAccountAdmins instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyEmailAccountAdmins object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyEmailAccountAdmins fromString(String value) { + SecurityAlertPolicyEmailAccountAdmins[] items = SecurityAlertPolicyEmailAccountAdmins.values(); + for (SecurityAlertPolicyEmailAccountAdmins item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..60842f6333363 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/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.v2014_04_01; + +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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyUseServerDefault.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyUseServerDefault.java new file mode 100644 index 0000000000000..7f45a8b34902e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyUseServerDefault.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyUseServerDefault. + */ +public enum SecurityAlertPolicyUseServerDefault { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyUseServerDefault instance. */ + private String value; + + SecurityAlertPolicyUseServerDefault(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyUseServerDefault instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyUseServerDefault object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyUseServerDefault fromString(String value) { + SecurityAlertPolicyUseServerDefault[] items = SecurityAlertPolicyUseServerDefault.values(); + for (SecurityAlertPolicyUseServerDefault item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java new file mode 100644 index 0000000000000..e2d14f49ecc37 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Servers. + */ +public interface Servers extends HasInner { + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String name); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveName.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveName.java new file mode 100644 index 0000000000000..5027a3f7a8bfa --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveName.java @@ -0,0 +1,230 @@ +/** + * 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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServiceObjectiveName. + */ +public final class ServiceObjectiveName extends ExpandableStringEnum { + /** Static value System for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM = fromString("System"); + + /** Static value System0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM0 = fromString("System0"); + + /** Static value System1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM1 = fromString("System1"); + + /** Static value System2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2 = fromString("System2"); + + /** Static value System3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3 = fromString("System3"); + + /** Static value System4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4 = fromString("System4"); + + /** Static value System2L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2L = fromString("System2L"); + + /** Static value System3L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3L = fromString("System3L"); + + /** Static value System4L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4L = fromString("System4L"); + + /** Static value Free for ServiceObjectiveName. */ + public static final ServiceObjectiveName FREE = fromString("Free"); + + /** Static value Basic for ServiceObjectiveName. */ + public static final ServiceObjectiveName BASIC = fromString("Basic"); + + /** Static value S0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S0 = fromString("S0"); + + /** Static value S1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S1 = fromString("S1"); + + /** Static value S2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S2 = fromString("S2"); + + /** Static value S3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S3 = fromString("S3"); + + /** Static value S4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S4 = fromString("S4"); + + /** Static value S6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S6 = fromString("S6"); + + /** Static value S7 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S7 = fromString("S7"); + + /** Static value S9 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S9 = fromString("S9"); + + /** Static value S12 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S12 = fromString("S12"); + + /** Static value P1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P1 = fromString("P1"); + + /** Static value P2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P2 = fromString("P2"); + + /** Static value P3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P3 = fromString("P3"); + + /** Static value P4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P4 = fromString("P4"); + + /** Static value P6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P6 = fromString("P6"); + + /** Static value P11 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P11 = fromString("P11"); + + /** Static value P15 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P15 = fromString("P15"); + + /** Static value PRS1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS1 = fromString("PRS1"); + + /** Static value PRS2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS2 = fromString("PRS2"); + + /** Static value PRS4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS4 = fromString("PRS4"); + + /** Static value PRS6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS6 = fromString("PRS6"); + + /** Static value DW100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW100 = fromString("DW100"); + + /** Static value DW200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW200 = fromString("DW200"); + + /** Static value DW300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW300 = fromString("DW300"); + + /** Static value DW400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW400 = fromString("DW400"); + + /** Static value DW500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW500 = fromString("DW500"); + + /** Static value DW600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW600 = fromString("DW600"); + + /** Static value DW1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000 = fromString("DW1000"); + + /** Static value DW1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1200 = fromString("DW1200"); + + /** Static value DW1000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000C = fromString("DW1000c"); + + /** Static value DW1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500 = fromString("DW1500"); + + /** Static value DW1500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500C = fromString("DW1500c"); + + /** Static value DW2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000 = fromString("DW2000"); + + /** Static value DW2000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000C = fromString("DW2000c"); + + /** Static value DW3000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000 = fromString("DW3000"); + + /** Static value DW2500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2500C = fromString("DW2500c"); + + /** Static value DW3000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000C = fromString("DW3000c"); + + /** Static value DW6000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000 = fromString("DW6000"); + + /** Static value DW5000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW5000C = fromString("DW5000c"); + + /** Static value DW6000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000C = fromString("DW6000c"); + + /** Static value DW7500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW7500C = fromString("DW7500c"); + + /** Static value DW10000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW10000C = fromString("DW10000c"); + + /** Static value DW15000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW15000C = fromString("DW15000c"); + + /** Static value DW30000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW30000C = fromString("DW30000c"); + + /** Static value DS100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS100 = fromString("DS100"); + + /** Static value DS200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS200 = fromString("DS200"); + + /** Static value DS300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS300 = fromString("DS300"); + + /** Static value DS400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS400 = fromString("DS400"); + + /** Static value DS500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS500 = fromString("DS500"); + + /** Static value DS600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS600 = fromString("DS600"); + + /** Static value DS1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1000 = fromString("DS1000"); + + /** Static value DS1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1200 = fromString("DS1200"); + + /** Static value DS1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1500 = fromString("DS1500"); + + /** Static value DS2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS2000 = fromString("DS2000"); + + /** Static value ElasticPool for ServiceObjectiveName. */ + public static final ServiceObjectiveName ELASTIC_POOL = fromString("ElasticPool"); + + /** + * Creates or finds a ServiceObjectiveName from its string representation. + * @param name a name to look for + * @return the corresponding ServiceObjectiveName + */ + @JsonCreator + public static ServiceObjectiveName fromString(String name) { + return fromString(name, ServiceObjectiveName.class); + } + + /** + * @return known ServiceObjectiveName values + */ + public static Collection values() { + return values(ServiceObjectiveName.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisor.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisor.java new file mode 100644 index 0000000000000..1a212dfc36351 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisor.java @@ -0,0 +1,135 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ServiceTierAdvisor. + */ +public interface ServiceTierAdvisor extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the activeTimeRatio value. + */ + Double activeTimeRatio(); + + /** + * @return the avgDtu value. + */ + Double avgDtu(); + + /** + * @return the confidence value. + */ + double confidence(); + + /** + * @return the currentServiceLevelObjective value. + */ + String currentServiceLevelObjective(); + + /** + * @return the currentServiceLevelObjectiveId value. + */ + UUID currentServiceLevelObjectiveId(); + + /** + * @return the databaseSizeBasedRecommendationServiceLevelObjective value. + */ + String databaseSizeBasedRecommendationServiceLevelObjective(); + + /** + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value. + */ + UUID databaseSizeBasedRecommendationServiceLevelObjectiveId(); + + /** + * @return the disasterPlanBasedRecommendationServiceLevelObjective value. + */ + String disasterPlanBasedRecommendationServiceLevelObjective(); + + /** + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value. + */ + UUID disasterPlanBasedRecommendationServiceLevelObjectiveId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxDtu value. + */ + Double maxDtu(); + + /** + * @return the maxSizeInGB value. + */ + Double maxSizeInGB(); + + /** + * @return the minDtu value. + */ + Double minDtu(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the observationPeriodEnd value. + */ + DateTime observationPeriodEnd(); + + /** + * @return the observationPeriodStart value. + */ + DateTime observationPeriodStart(); + + /** + * @return the overallRecommendationServiceLevelObjective value. + */ + String overallRecommendationServiceLevelObjective(); + + /** + * @return the overallRecommendationServiceLevelObjectiveId value. + */ + UUID overallRecommendationServiceLevelObjectiveId(); + + /** + * @return the serviceLevelObjectiveUsageMetrics value. + */ + List serviceLevelObjectiveUsageMetrics(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageBasedRecommendationServiceLevelObjective value. + */ + String usageBasedRecommendationServiceLevelObjective(); + + /** + * @return the usageBasedRecommendationServiceLevelObjectiveId value. + */ + UUID usageBasedRecommendationServiceLevelObjectiveId(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisors.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisors.java new file mode 100644 index 0000000000000..e3de82242f905 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisors.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServiceTierAdvisors. + */ +public interface ServiceTierAdvisors extends HasInner { + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName); + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SloUsageMetric.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SloUsageMetric.java new file mode 100644 index 0000000000000..148d3ddd64c72 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SloUsageMetric.java @@ -0,0 +1,72 @@ +/** + * 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.v2014_04_01; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Slo Usage Metric. + */ +public class SloUsageMetric { + /** + * The serviceLevelObjective for SLO usage metric. Possible values include: + * 'System', 'System0', 'System1', 'System2', 'System3', 'System4', + * 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', + * 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', + * 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', + * 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', + * 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', + * 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', + * 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', + * 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /** + * The serviceLevelObjectiveId for SLO usage metric. + */ + @JsonProperty(value = "serviceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID serviceLevelObjectiveId; + + /** + * Gets or sets inRangeTimeRatio for SLO usage metric. + */ + @JsonProperty(value = "inRangeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private double inRangeTimeRatio; + + /** + * Get the serviceLevelObjective for SLO usage metric. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceLevelObjective value + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the serviceLevelObjectiveId for SLO usage metric. + * + * @return the serviceLevelObjectiveId value + */ + public UUID serviceLevelObjectiveId() { + return this.serviceLevelObjectiveId; + } + + /** + * Get gets or sets inRangeTimeRatio for SLO usage metric. + * + * @return the inRangeTimeRatio value + */ + public double inRangeTimeRatio() { + return this.inRangeTimeRatio; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/StorageKeyType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/StorageKeyType.java new file mode 100644 index 0000000000000..c561f5ac0db5a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/StorageKeyType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for StorageKeyType. + */ +public enum StorageKeyType { + /** Enum value StorageAccessKey. */ + STORAGE_ACCESS_KEY("StorageAccessKey"), + + /** Enum value SharedAccessKey. */ + SHARED_ACCESS_KEY("SharedAccessKey"); + + /** The actual serialized value for a StorageKeyType instance. */ + private String value; + + StorageKeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StorageKeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed StorageKeyType object, or null if unable to parse. + */ + @JsonCreator + public static StorageKeyType fromString(String value) { + StorageKeyType[] items = StorageKeyType.values(); + for (StorageKeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryption.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryption.java new file mode 100644 index 0000000000000..bd3f35a4e42fd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryption.java @@ -0,0 +1,45 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionInner; + +/** + * Type representing TransparentDataEncryption. + */ +public interface TransparentDataEncryption extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the status value. + */ + TransparentDataEncryptionStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivities.java new file mode 100644 index 0000000000000..27cd841eb2c0a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivities.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TransparentDataEncryptionActivities. + */ +public interface TransparentDataEncryptionActivities extends HasInner { + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivity.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivity.java new file mode 100644 index 0000000000000..410a43f8549a7 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivity.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionActivityInner; + +/** + * Type representing TransparentDataEncryptionActivity. + */ +public interface TransparentDataEncryptionActivity extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the percentComplete value. + */ + Double percentComplete(); + + /** + * @return the status value. + */ + TransparentDataEncryptionActivityStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivityStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivityStatus.java new file mode 100644 index 0000000000000..425685654c759 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivityStatus.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TransparentDataEncryptionActivityStatus. + */ +public final class TransparentDataEncryptionActivityStatus extends ExpandableStringEnum { + /** Static value Encrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus ENCRYPTING = fromString("Encrypting"); + + /** Static value Decrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus DECRYPTING = fromString("Decrypting"); + + /** + * Creates or finds a TransparentDataEncryptionActivityStatus from its string representation. + * @param name a name to look for + * @return the corresponding TransparentDataEncryptionActivityStatus + */ + @JsonCreator + public static TransparentDataEncryptionActivityStatus fromString(String name) { + return fromString(name, TransparentDataEncryptionActivityStatus.class); + } + + /** + * @return known TransparentDataEncryptionActivityStatus values + */ + public static Collection values() { + return values(TransparentDataEncryptionActivityStatus.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionStatus.java new file mode 100644 index 0000000000000..6720aabb6308b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionStatus.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TransparentDataEncryptionStatus. + */ +public enum TransparentDataEncryptionStatus { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a TransparentDataEncryptionStatus instance. */ + private String value; + + TransparentDataEncryptionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TransparentDataEncryptionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed TransparentDataEncryptionStatus object, or null if unable to parse. + */ + @JsonCreator + public static TransparentDataEncryptionStatus fromString(String value) { + TransparentDataEncryptionStatus[] items = TransparentDataEncryptionStatus.values(); + for (TransparentDataEncryptionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptions.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptions.java new file mode 100644 index 0000000000000..0ca5573bdee8c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptions.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TransparentDataEncryptions. + */ +public interface TransparentDataEncryptions extends HasInner { + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..c25633610cf51 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityReason; + +class CheckNameAvailabilityResponseImpl extends WrapperImpl implements CheckNameAvailabilityResponse { + private final SqlManager manager; + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Boolean available() { + return this.inner().available(); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public CheckNameAvailabilityReason reason() { + return this.inner().reason(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..f1f75cf97c261 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,82 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A response indicating whether the specified name for a resource is + * available. + */ +public class CheckNameAvailabilityResponseInner { + /** + * True if the name is available, otherwise false. + */ + @JsonProperty(value = "available", access = JsonProperty.Access.WRITE_ONLY) + private Boolean available; + + /** + * A message explaining why the name is unavailable. Will be null if the + * name is available. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The name whose availability was checked. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The reason code explaining why the name is unavailable. Will be null if + * the name is available. Possible values include: 'Invalid', + * 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private CheckNameAvailabilityReason reason; + + /** + * Get true if the name is available, otherwise false. + * + * @return the available value + */ + public Boolean available() { + return this.available; + } + + /** + * Get a message explaining why the name is unavailable. Will be null if the name is available. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the name whose availability was checked. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the reason code explaining why the name is unavailable. Will be null if the name is available. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..e86c1cac6c001 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.Database; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUpdate; +import java.util.Map; +import org.joda.time.DateTime; +import java.util.UUID; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.CreateMode; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseEdition; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjectiveName; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedIndex; +import com.microsoft.azure.management.sql.v2014_04_01.ReadScale; +import com.microsoft.azure.management.sql.v2014_04_01.SampleName; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisor; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryption; +import rx.functions.Func1; + +class DatabaseImpl extends CreatableUpdatableImpl implements Database, Database.Definition, Database.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private DatabaseUpdate updateParameter; + + DatabaseImpl(String name, SqlManager manager) { + super(name, new DatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new DatabaseUpdate(); + } + + DatabaseImpl(DatabaseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public Long containmentState() { + return this.inner().containmentState(); + } + + @Override + public CreateMode createMode() { + return this.inner().createMode(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public UUID currentServiceObjectiveId() { + return this.inner().currentServiceObjectiveId(); + } + + @Override + public UUID databaseId() { + return this.inner().databaseId(); + } + + @Override + public String defaultSecondaryLocation() { + return this.inner().defaultSecondaryLocation(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public DatabaseEdition edition() { + return this.inner().edition(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public String failoverGroupId() { + return this.inner().failoverGroupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ReadScale readScale() { + return this.inner().readScale(); + } + + @Override + public List recommendedIndex() { + return this.inner().recommendedIndex(); + } + + @Override + public String recoveryServicesRecoveryPointResourceId() { + return this.inner().recoveryServicesRecoveryPointResourceId(); + } + + @Override + public UUID requestedServiceObjectiveId() { + return this.inner().requestedServiceObjectiveId(); + } + + @Override + public ServiceObjectiveName requestedServiceObjectiveName() { + return this.inner().requestedServiceObjectiveName(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public SampleName sampleName() { + return this.inner().sampleName(); + } + + @Override + public ServiceObjectiveName serviceLevelObjective() { + return this.inner().serviceLevelObjective(); + } + + @Override + public List serviceTierAdvisors() { + List lst = new ArrayList(); + if (this.inner().serviceTierAdvisors() != null) { + for (ServiceTierAdvisorInner inner : this.inner().serviceTierAdvisors()) { + lst.add( new ServiceTierAdvisorImpl(inner, manager())); + } + } + return lst; + } + + @Override + public DateTime sourceDatabaseDeletionDate() { + return this.inner().sourceDatabaseDeletionDate(); + } + + @Override + public String sourceDatabaseId() { + return this.inner().sourceDatabaseId(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public List transparentDataEncryption() { + List lst = new ArrayList(); + if (this.inner().transparentDataEncryption() != null) { + for (TransparentDataEncryptionInner inner : this.inner().transparentDataEncryption()) { + lst.add( new TransparentDataEncryptionImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public DatabaseImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public DatabaseImpl withCreateMode(CreateMode createMode) { + if (isInCreateMode()) { + this.inner().withCreateMode(createMode); + } else { + this.updateParameter.withCreateMode(createMode); + } + return this; + } + + @Override + public DatabaseImpl withEdition(DatabaseEdition edition) { + if (isInCreateMode()) { + this.inner().withEdition(edition); + } else { + this.updateParameter.withEdition(edition); + } + return this; + } + + @Override + public DatabaseImpl withElasticPoolName(String elasticPoolName) { + if (isInCreateMode()) { + this.inner().withElasticPoolName(elasticPoolName); + } else { + this.updateParameter.withElasticPoolName(elasticPoolName); + } + return this; + } + + @Override + public DatabaseImpl withMaxSizeBytes(String maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public DatabaseImpl withReadScale(ReadScale readScale) { + if (isInCreateMode()) { + this.inner().withReadScale(readScale); + } else { + this.updateParameter.withReadScale(readScale); + } + return this; + } + + @Override + public DatabaseImpl withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId) { + if (isInCreateMode()) { + this.inner().withRecoveryServicesRecoveryPointResourceId(recoveryServicesRecoveryPointResourceId); + } else { + this.updateParameter.withRecoveryServicesRecoveryPointResourceId(recoveryServicesRecoveryPointResourceId); + } + return this; + } + + @Override + public DatabaseImpl withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId) { + if (isInCreateMode()) { + this.inner().withRequestedServiceObjectiveId(requestedServiceObjectiveId); + } else { + this.updateParameter.withRequestedServiceObjectiveId(requestedServiceObjectiveId); + } + return this; + } + + @Override + public DatabaseImpl withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName) { + if (isInCreateMode()) { + this.inner().withRequestedServiceObjectiveName(requestedServiceObjectiveName); + } else { + this.updateParameter.withRequestedServiceObjectiveName(requestedServiceObjectiveName); + } + return this; + } + + @Override + public DatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public DatabaseImpl withSampleName(SampleName sampleName) { + if (isInCreateMode()) { + this.inner().withSampleName(sampleName); + } else { + this.updateParameter.withSampleName(sampleName); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } else { + this.updateParameter.withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + } else { + this.updateParameter.withSourceDatabaseId(sourceDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseInner.java new file mode 100644 index 0000000000000..5cc5b1b54d285 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseInner.java @@ -0,0 +1,719 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2014_04_01.CreateMode; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseEdition; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjectiveName; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedIndex; +import com.microsoft.azure.management.sql.v2014_04_01.ReadScale; +import com.microsoft.azure.management.sql.v2014_04_01.SampleName; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Represents a database. + */ +@JsonFlatten +public class DatabaseInner extends Resource { + /** + * Kind of database. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The collation of the database. If createMode is not Default, this value + * is ignored. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The containment state of the database. + */ + @JsonProperty(value = "properties.containmentState", access = JsonProperty.Access.WRITE_ONLY) + private Long containmentState; + + /** + * The current service level objective ID of the database. This is the ID + * of the service level objective that is currently active. + */ + @JsonProperty(value = "properties.currentServiceObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceObjectiveId; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * OnlineSecondary/NonReadableSecondary: creates a database as a (readable + * or nonreadable) secondary replica of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing + * primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, NonReadableSecondary, OnlineSecondary and + * RestoreLongTermRetentionBackup are not supported for DataWarehouse + * edition. Possible values include: 'Copy', 'Default', + * 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', + * 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * Conditional. If createMode is Copy, NonReadableSecondary, + * OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this + * value is required. Specifies the resource ID of the source database. If + * createMode is NonReadableSecondary or OnlineSecondary, the name of the + * source database must be the same as the new database being created. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * Conditional. If createMode is Restore and sourceDatabaseId is the + * deleted database's original resource id when it existed (as opposed to + * its current restorable dropped database id), then this value is + * required. Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. If createMode is Restore, this value is optional. Specifies + * the point in time (ISO8601 format) of the source database that will be + * restored to create the new database. Must be greater than or equal to + * the source database's earliestRestoreDate value. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Conditional. If createMode is RestoreLongTermRetentionBackup, then this + * value is required. Specifies the resource ID of the recovery point to + * restore from. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointResourceId") + private String recoveryServicesRecoveryPointResourceId; + + /** + * The edition of the database. The DatabaseEditions enumeration contains + * all the valid editions. If createMode is NonReadableSecondary or + * OnlineSecondary, this value is ignored. To see possible values, query + * the capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions -l westus --query [].name`. + * Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2'. + */ + @JsonProperty(value = "properties.edition") + private DatabaseEdition edition; + + /** + * The max size of the database expressed in bytes. If createMode is not + * Default, this value is ignored. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation.". + */ + @JsonProperty(value = "properties.maxSizeBytes") + private String maxSizeBytes; + + /** + * The configured service level objective ID of the database. This is the + * service level objective that is in the process of being applied to the + * database. Once successfully updated, it will match the value of + * currentServiceObjectiveId property. If requestedServiceObjectiveId and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveId overrides the value of + * requestedServiceObjectiveName. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name` . + */ + @JsonProperty(value = "properties.requestedServiceObjectiveId") + private UUID requestedServiceObjectiveId; + + /** + * The name of the configured service level objective of the database. This + * is the service level objective that is in the process of being applied + * to the database. Once successfully updated, it will match the value of + * serviceLevelObjective property. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name`. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName") + private ServiceObjectiveName requestedServiceObjectiveName; + + /** + * The current service level objective of the database. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /** + * The status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The name of the elastic pool the database is in. If elasticPoolName and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveName is ignored. Not supported for + * DataWarehouse edition. + */ + @JsonProperty(value = "properties.elasticPoolName") + private String elasticPoolName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * The list of service tier advisors for this database. Expanded property. + */ + @JsonProperty(value = "properties.serviceTierAdvisors", access = JsonProperty.Access.WRITE_ONLY) + private List serviceTierAdvisors; + + /** + * The transparent data encryption info for this database. + */ + @JsonProperty(value = "properties.transparentDataEncryption", access = JsonProperty.Access.WRITE_ONLY) + private List transparentDataEncryption; + + /** + * The recommended indices for this database. + */ + @JsonProperty(value = "properties.recommendedIndex", access = JsonProperty.Access.WRITE_ONLY) + private List recommendedIndex; + + /** + * The resource identifier of the failover group containing this database. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Conditional. If the database is a geo-secondary, readScale indicates + * whether read-only connections are allowed to this database or not. Not + * supported for DataWarehouse edition. Possible values include: 'Enabled', + * 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private ReadScale readScale; + + /** + * Indicates the name of the sample schema to apply when creating this + * database. If createMode is not Default, this value is ignored. Not + * supported for DataWarehouse edition. Possible values include: + * 'AdventureWorksLT'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Get kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the collation of the database. If createMode is not Default, this value is ignored. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. If createMode is not Default, this value is ignored. + * + * @param collation the collation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the containment state of the database. + * + * @return the containmentState value + */ + public Long containmentState() { + return this.containmentState; + } + + /** + * Get the current service level objective ID of the database. This is the ID of the service level objective that is currently active. + * + * @return the currentServiceObjectiveId value + */ + public UUID currentServiceObjectiveId() { + return this.currentServiceObjectiveId; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @return the recoveryServicesRecoveryPointResourceId value + */ + public String recoveryServicesRecoveryPointResourceId() { + return this.recoveryServicesRecoveryPointResourceId; + } + + /** + * Set conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @param recoveryServicesRecoveryPointResourceId the recoveryServicesRecoveryPointResourceId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId) { + this.recoveryServicesRecoveryPointResourceId = recoveryServicesRecoveryPointResourceId; + return this; + } + + /** + * Get the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @param edition the edition value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @return the requestedServiceObjectiveId value + */ + public UUID requestedServiceObjectiveId() { + return this.requestedServiceObjectiveId; + } + + /** + * Set the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @param requestedServiceObjectiveId the requestedServiceObjectiveId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId) { + this.requestedServiceObjectiveId = requestedServiceObjectiveId; + return this; + } + + /** + * Get the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the requestedServiceObjectiveName value + */ + public ServiceObjectiveName requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Set the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @param requestedServiceObjectiveName the requestedServiceObjectiveName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName) { + this.requestedServiceObjectiveName = requestedServiceObjectiveName; + return this; + } + + /** + * Get the current service level objective of the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceLevelObjective value + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the status of the database. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the list of service tier advisors for this database. Expanded property. + * + * @return the serviceTierAdvisors value + */ + public List serviceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** + * Get the transparent data encryption info for this database. + * + * @return the transparentDataEncryption value + */ + public List transparentDataEncryption() { + return this.transparentDataEncryption; + } + + /** + * Get the recommended indices for this database. + * + * @return the recommendedIndex value + */ + public List recommendedIndex() { + return this.recommendedIndex; + } + + /** + * Get the resource identifier of the failover group containing this database. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public ReadScale readScale() { + return this.readScale; + } + + /** + * Set conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(ReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..04b53bf0bcdee --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,202 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyState; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyEmailAccountAdmins; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyUseServerDefault; + +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(); + // resource ancestor names + 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() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public String emailAddresses() { + return this.inner().emailAddresses(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @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 SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.inner().useServerDefault(); + } + + @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(String disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAddresses(String emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withLocation(String location) { + this.inner().withLocation(location); + 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; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.inner().withUseServerDefault(useServerDefault); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..7a528d7a582eb --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,283 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyState; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyEmailAccountAdmins; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyUseServerDefault; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Contains information about a database Threat Detection policy. + */ +@JsonFlatten +public class DatabaseSecurityAlertPolicyInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * and storageAccountAccessKey are required. Possible values include: + * 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies the semicolon-separated list of alerts that are disabled, or + * empty string to disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + */ + @JsonProperty(value = "properties.disabledAlerts") + private String disabledAlerts; + + /** + * Specifies the semicolon-separated list of e-mail addresses to which the + * alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private String emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. If state is Enabled, storageEndpoint is + * required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + */ + @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 whether to use the default server policy. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.useServerDefault") + private SecurityAlertPolicyUseServerDefault useServerDefault; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. 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 the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * + * @return the disabledAlerts value + */ + public String disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * + * @param disabledAlerts the disabledAlerts value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withDisabledAlerts(String disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies the semicolon-separated list of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public String emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies the semicolon-separated list 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(String emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. Possible values include: 'Enabled', 'Disabled'. + * + * @return the emailAccountAdmins value + */ + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. Possible values include: 'Enabled', 'Disabled'. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins 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. If state is Enabled, storageEndpoint is required. + * + * @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. If state is Enabled, storageEndpoint is required. + * + * @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. If state is Enabled, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. + * + * @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 whether to use the default server policy. Possible values include: 'Enabled', 'Disabled'. + * + * @return the useServerDefault value + */ + public SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.useServerDefault; + } + + /** + * Set specifies whether to use the default server policy. Possible values include: 'Enabled', 'Disabled'. + * + * @param useServerDefault the useServerDefault value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.useServerDefault = useServerDefault; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesImpl.java new file mode 100644 index 0000000000000..0fcf96b45a379 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseSecurityAlertPolicy; + +class DatabaseThreatDetectionPoliciesImpl extends WrapperImpl implements DatabaseThreatDetectionPolicies { + private final SqlManager manager; + + DatabaseThreatDetectionPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseThreatDetectionPolicies()); + 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 getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseThreatDetectionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseSecurityAlertPolicy call(DatabaseSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java new file mode 100644 index 0000000000000..75e528ee51d35 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v2014_04_01.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseThreatDetectionPolicies. + */ +public class DatabaseThreatDetectionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseThreatDetectionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseThreatDetectionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseThreatDetectionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseThreatDetectionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseThreatDetectionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseThreatDetectionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @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.v2014_04_01.DatabaseThreatDetectionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Body DatabaseSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's threat detection 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 database Threat Detection 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 threat detection 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 database Threat Detection 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 threat detection 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 database Threat Detection 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 threat detection 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 database Threat Detection 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 (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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, securityAlertPolicyName, 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 (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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, securityAlertPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..a1e17953b8ea5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java @@ -0,0 +1,193 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Databases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.Database; +import com.microsoft.azure.management.sql.v2014_04_01.ImportExportResponse; +import com.microsoft.azure.management.sql.v2014_04_01.ExportRequest; +import com.microsoft.azure.management.sql.v2014_04_01.ImportRequest; + +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 DatabaseImpl define(String name) { + return wrapModel(name); + } + + private DatabaseImpl wrapModel(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + + private DatabaseImpl wrapModel(String name) { + return new DatabaseImpl(name, this.manager()); + } + + @Override + public Completable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.pauseAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public Completable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.resumeAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public Observable getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getByRecommendedElasticPoolAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByRecommendedElasticPoolAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + DatabasesInner client = this.inner(); + return client.exportAsync(resourceGroupName, serverName, databaseName, parameters) + .map(new Func1() { + @Override + public ImportExportResponse call(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + DatabasesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public ImportExportResponseImpl defineExtension(String name) { + return wrapExtensionModel(name); + } + + private ImportExportResponseImpl wrapExtensionModel(String name) { + return new ImportExportResponseImpl(name, this.manager()); + } + + private ImportExportResponseImpl wrapImportExportResponseModel(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + + @Override + public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + DatabasesInner client = this.inner(); + return client.importMethodAsync(resourceGroupName, serverName, parameters) + .map(new Func1() { + @Override + public ImportExportResponse call(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..d1ccf2cecc619 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java @@ -0,0 +1,2264 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUpdate; +import com.microsoft.azure.management.sql.v2014_04_01.ExportRequest; +import com.microsoft.azure.management.sql.v2014_04_01.ImportExtensionRequest; +import com.microsoft.azure.management.sql.v2014_04_01.ImportRequest; +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.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.v2014_04_01.Databases pause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> pause(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2014_04_01.Databases beginPause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> beginPause(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2014_04_01.Databases resume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> resume(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2014_04_01.Databases beginResume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> beginResume(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2014_04_01.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseInner 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.v2014_04_01.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseInner 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.v2014_04_01.Databases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseUpdate 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.v2014_04_01.Databases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseUpdate 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.v2014_04_01.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2014_04_01.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @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.v2014_04_01.Databases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases") + Observable> listByServer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @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.v2014_04_01.Databases getByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}") + Observable> getByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("databaseName") String databaseName, @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.v2014_04_01.Databases listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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.v2014_04_01.Databases getByRecommendedElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}") + Observable> getByRecommendedElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Path("databaseName") String databaseName, @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.v2014_04_01.Databases listByRecommendedElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases") + Observable> listByRecommendedElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @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.v2014_04_01.Databases importMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") + Observable> importMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest 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.v2014_04_01.Databases beginImportMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") + Observable> beginImportMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest 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.v2014_04_01.Databases createImportOperation" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") + Observable> createImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest 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.v2014_04_01.Databases beginCreateImportOperation" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") + Observable> beginCreateImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest 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.v2014_04_01.Databases export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> export(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest 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.v2014_04_01.Databases beginExport" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> beginExport(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 pause(String resourceGroupName, String serverName, String databaseName) { + pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 pauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> pauseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.pause(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 beginPause(String resourceGroupName, String serverName, String databaseName) { + beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 beginPauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginPauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginPauseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.beginPause(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginPauseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPauseDelegate(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); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 resume(String resourceGroupName, String serverName, String databaseName) { + resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 resumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resumeWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.resume(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 beginResume(String resourceGroupName, String serverName, String databaseName) { + beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 beginResumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginResumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginResumeWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.beginResume(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginResumeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResumeDelegate(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); + } + + /** + * 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, 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); + } + + /** + * 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, 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); + } + + /** + * Deletes 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 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 serverName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes 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 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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes 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 be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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 be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets 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 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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets 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 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 getAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), expand, 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); + } + } + }); + } + + /** + * Gets 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 be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand).toBlocking().single().body(); + } + + /** + * Gets 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 be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @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, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand), serviceCallback); + } + + /** + * Gets 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 be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String expand) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), expand, 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); + } + + /** + * Returns a list of databases in 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 List<DatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns a list of databases in 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns a list of databases in 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 List<DatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases in 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 List<DatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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 expand = null; + final String filter = null; + return service.listByServer(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Returns a list of databases in 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 expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @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 List<DatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName, String expand, String filter) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter).toBlocking().single().body(); + } + + /** + * Returns a list of databases in 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 expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @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(String resourceGroupName, String serverName, String expand, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter), serviceCallback); + } + + /** + * Returns a list of databases in 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 expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName, String expand, String filter) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases in 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 expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(String resourceGroupName, String serverName, String expand, String filter) { + 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(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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 database inside of 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 be retrieved. + * @param databaseName The name of the database 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 DatabaseInner object if successful. + */ + public DatabaseInner getByElasticPool(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + return getByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database inside of 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 be retrieved. + * @param databaseName The name of the database 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 getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, databaseName), serviceCallback); + } + + /** + * Gets a database inside of 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 be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + return getByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database inside of 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 be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.getByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByElasticPoolDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByElasticPoolDelegate(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); + } + + /** + * Returns a list of databases in 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 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 List<DatabaseInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns a list of databases in 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 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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns a list of databases in 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases in 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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 inside of a recommented 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database 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 DatabaseInner object if successful. + */ + public DatabaseInner getByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database inside of a recommented 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database 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 getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName), serviceCallback); + } + + /** + * Gets a database inside of a recommented 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database inside of a recommented 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getByRecommendedElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + 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 (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.getByRecommendedElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByRecommendedElasticPoolDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByRecommendedElasticPoolDelegate(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); + } + + /** + * Returns a list of databases inside a recommented 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 recommendedElasticPoolName The name of the recommended elastic 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 List<DatabaseInner> object if successful. + */ + public List listByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Returns a list of databases inside a recommented 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 recommendedElasticPoolName The name of the recommended elastic 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> listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Returns a list of databases inside a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases inside a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByRecommendedElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + 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 (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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.listByRecommendedElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByRecommendedElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByRecommendedElasticPoolDelegate(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); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner importMethod(String resourceGroupName, String serverName, ImportRequest parameters) { + return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> importMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest 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); + Observable> observable = service.importMethod(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginImportMethod(String resourceGroupName, String serverName, ImportRequest parameters) { + return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginImportMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest 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); + return service.beginImportMethod(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginImportMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginImportMethodDelegate(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); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 extensionName = "import"; + Observable> observable = service.createImportOperation(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, extensionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginCreateImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginCreateImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 extensionName = "import"; + return service.beginCreateImportOperation(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, extensionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateImportOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateImportOperationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner export(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + Observable> observable = service.export(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginExport(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginExportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + return service.beginExport(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginExportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExportDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesImpl.java new file mode 100644 index 0000000000000..6d3add08855fb --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivity; + +class ElasticPoolActivitiesImpl extends WrapperImpl implements ElasticPoolActivities { + private final SqlManager manager; + + ElasticPoolActivitiesImpl(SqlManager manager) { + super(manager.inner().elasticPoolActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolActivitiesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolActivity call(ElasticPoolActivityInner inner) { + return new ElasticPoolActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java new file mode 100644 index 0000000000000..423b827d66989 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPoolActivities. + */ +public class ElasticPoolActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivities listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @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 List<ElasticPoolActivityInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolActivityInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolActivityInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityImpl.java new file mode 100644 index 0000000000000..6b10ff2146ec3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.UUID; + +class ElasticPoolActivityImpl extends WrapperImpl implements ElasticPoolActivity { + private final SqlManager manager; + ElasticPoolActivityImpl(ElasticPoolActivityInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public UUID operationId() { + return this.inner().operationId(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public Integer requestedDatabaseDtuCap() { + return this.inner().requestedDatabaseDtuCap(); + } + + @Override + public Integer requestedDatabaseDtuGuarantee() { + return this.inner().requestedDatabaseDtuGuarantee(); + } + + @Override + public Integer requestedDatabaseDtuMax() { + return this.inner().requestedDatabaseDtuMax(); + } + + @Override + public Integer requestedDatabaseDtuMin() { + return this.inner().requestedDatabaseDtuMin(); + } + + @Override + public Integer requestedDtu() { + return this.inner().requestedDtu(); + } + + @Override + public Integer requestedDtuGuarantee() { + return this.inner().requestedDtuGuarantee(); + } + + @Override + public String requestedElasticPoolName() { + return this.inner().requestedElasticPoolName(); + } + + @Override + public Long requestedStorageLimitInGB() { + return this.inner().requestedStorageLimitInGB(); + } + + @Override + public Integer requestedStorageLimitInMB() { + return this.inner().requestedStorageLimitInMB(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityInner.java new file mode 100644 index 0000000000000..709126b0b4b7a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityInner.java @@ -0,0 +1,348 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents the activity on an elastic pool. + */ +@JsonFlatten +public class ElasticPoolActivityInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /** + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The requested max DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMax", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMax; + + /** + * The requested min DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMin", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMin; + + /** + * The requested DTU for the pool if available. + */ + @JsonProperty(value = "properties.requestedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtu; + + /** + * The requested name for the elastic pool if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /** + * The requested storage limit for the pool in GB if available. + */ + @JsonProperty(value = "properties.requestedStorageLimitInGB", access = JsonProperty.Access.WRITE_ONLY) + private Long requestedStorageLimitInGB; + + /** + * The name of the elastic pool. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The requested storage limit in MB. + */ + @JsonProperty(value = "properties.requestedStorageLimitInMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedStorageLimitInMB; + + /** + * The requested per database DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuGuarantee; + + /** + * The requested per database DTU cap. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuCap", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuCap; + + /** + * The requested DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtuGuarantee; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the ElasticPoolActivityInner object itself. + */ + public ElasticPoolActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the time the operation finished (ISO8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the error code if available. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the error message if available. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the error severity if available. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the unique operation ID. + * + * @return the operationId value + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentage complete if available. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value + */ + public Integer requestedDatabaseDtuMax() { + return this.requestedDatabaseDtuMax; + } + + /** + * Get the requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value + */ + public Integer requestedDatabaseDtuMin() { + return this.requestedDatabaseDtuMin; + } + + /** + * Get the requested DTU for the pool if available. + * + * @return the requestedDtu value + */ + public Integer requestedDtu() { + return this.requestedDtu; + } + + /** + * Get the requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value + */ + public Long requestedStorageLimitInGB() { + return this.requestedStorageLimitInGB; + } + + /** + * Get the name of the elastic pool. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the name of the server the elastic pool is in. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the time the operation started (ISO8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the current state of the operation. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value + */ + public Integer requestedStorageLimitInMB() { + return this.requestedStorageLimitInMB; + } + + /** + * Get the requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value + */ + public Integer requestedDatabaseDtuGuarantee() { + return this.requestedDatabaseDtuGuarantee; + } + + /** + * Get the requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value + */ + public Integer requestedDatabaseDtuCap() { + return this.requestedDatabaseDtuCap; + } + + /** + * Get the requested DTU guarantee. + * + * @return the requestedDtuGuarantee value + */ + public Integer requestedDtuGuarantee() { + return this.requestedDtuGuarantee; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesImpl.java new file mode 100644 index 0000000000000..a26dd566926c5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivity; + +class ElasticPoolDatabaseActivitiesImpl extends WrapperImpl implements ElasticPoolDatabaseActivities { + private final SqlManager manager; + + ElasticPoolDatabaseActivitiesImpl(SqlManager manager) { + super(manager.inner().elasticPoolDatabaseActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolDatabaseActivitiesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolDatabaseActivity call(ElasticPoolDatabaseActivityInner inner) { + return new ElasticPoolDatabaseActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesInner.java new file mode 100644 index 0000000000000..b307d0ef72cd5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPoolDatabaseActivities. + */ +public class ElasticPoolDatabaseActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolDatabaseActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolDatabaseActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolDatabaseActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolDatabaseActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolDatabaseActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolDatabaseActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivities listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns activity on databases inside of 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. + * @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 List<ElasticPoolDatabaseActivityInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns activity on databases inside of 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. + * @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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns activity on databases inside of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns activity on databases inside of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityImpl.java new file mode 100644 index 0000000000000..9a04cf4216fd4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.UUID; + +class ElasticPoolDatabaseActivityImpl extends WrapperImpl implements ElasticPoolDatabaseActivity { + private final SqlManager manager; + ElasticPoolDatabaseActivityImpl(ElasticPoolDatabaseActivityInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String currentElasticPoolName() { + return this.inner().currentElasticPoolName(); + } + + @Override + public String currentServiceObjective() { + return this.inner().currentServiceObjective(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public UUID operationId() { + return this.inner().operationId(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String requestedElasticPoolName() { + return this.inner().requestedElasticPoolName(); + } + + @Override + public String requestedServiceObjective() { + return this.inner().requestedServiceObjective(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityInner.java new file mode 100644 index 0000000000000..3ee41a2e29970 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityInner.java @@ -0,0 +1,273 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents the activity on an elastic pool. + */ +@JsonFlatten +public class ElasticPoolDatabaseActivityInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The database name. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /** + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The name for the elastic pool the database is moving into if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /** + * The name of the current elastic pool the database is in if available. + */ + @JsonProperty(value = "properties.currentElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String currentElasticPoolName; + + /** + * The name of the current service objective if available. + */ + @JsonProperty(value = "properties.currentServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjective; + + /** + * The name of the requested service objective if available. + */ + @JsonProperty(value = "properties.requestedServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjective; + + /** + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the ElasticPoolDatabaseActivityInner object itself. + */ + public ElasticPoolDatabaseActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the time the operation finished (ISO8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the error code if available. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the error message if available. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the error severity if available. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the unique operation ID. + * + * @return the operationId value + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentage complete if available. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the name for the elastic pool the database is moving into if available. + * + * @return the requestedElasticPoolName value + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the name of the current elastic pool the database is in if available. + * + * @return the currentElasticPoolName value + */ + public String currentElasticPoolName() { + return this.currentElasticPoolName; + } + + /** + * Get the name of the current service objective if available. + * + * @return the currentServiceObjective value + */ + public String currentServiceObjective() { + return this.currentServiceObjective; + } + + /** + * Get the name of the requested service objective if available. + * + * @return the requestedServiceObjective value + */ + public String requestedServiceObjective() { + return this.requestedServiceObjective; + } + + /** + * Get the name of the server the elastic pool is in. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the time the operation started (ISO8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the current state of the operation. + * + * @return the state value + */ + public String state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolImpl.java new file mode 100644 index 0000000000000..559f0e2c34749 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolImpl.java @@ -0,0 +1,251 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPool; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolUpdate; +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolState; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +import rx.functions.Func1; + +class ElasticPoolImpl extends CreatableUpdatableImpl implements ElasticPool, ElasticPool.Definition, ElasticPool.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String elasticPoolName; + private ElasticPoolUpdate updateParameter; + + ElasticPoolImpl(String name, SqlManager manager) { + super(name, new ElasticPoolInner()); + this.manager = manager; + // Set resource name + this.elasticPoolName = name; + // + this.updateParameter = new ElasticPoolUpdate(); + } + + ElasticPoolImpl(ElasticPoolInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.elasticPoolName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.elasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "elasticPools"); + // + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.inner()) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.updateParameter) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.elasticPoolName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public Integer databaseDtuMax() { + return this.inner().databaseDtuMax(); + } + + @Override + public Integer databaseDtuMin() { + return this.inner().databaseDtuMin(); + } + + @Override + public Integer dtu() { + return this.inner().dtu(); + } + + @Override + public ElasticPoolEdition edition() { + return this.inner().edition(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ElasticPoolState state() { + return this.inner().state(); + } + + @Override + public Integer storageMB() { + return this.inner().storageMB(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public ElasticPoolImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ElasticPoolImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ElasticPoolImpl withDatabaseDtuMax(Integer databaseDtuMax) { + if (isInCreateMode()) { + this.inner().withDatabaseDtuMax(databaseDtuMax); + } else { + this.updateParameter.withDatabaseDtuMax(databaseDtuMax); + } + return this; + } + + @Override + public ElasticPoolImpl withDatabaseDtuMin(Integer databaseDtuMin) { + if (isInCreateMode()) { + this.inner().withDatabaseDtuMin(databaseDtuMin); + } else { + this.updateParameter.withDatabaseDtuMin(databaseDtuMin); + } + return this; + } + + @Override + public ElasticPoolImpl withDtu(Integer dtu) { + if (isInCreateMode()) { + this.inner().withDtu(dtu); + } else { + this.updateParameter.withDtu(dtu); + } + return this; + } + + @Override + public ElasticPoolImpl withEdition(ElasticPoolEdition edition) { + if (isInCreateMode()) { + this.inner().withEdition(edition); + } else { + this.updateParameter.withEdition(edition); + } + return this; + } + + @Override + public ElasticPoolImpl withStorageMB(Integer storageMB) { + if (isInCreateMode()) { + this.inner().withStorageMB(storageMB); + } else { + this.updateParameter.withStorageMB(storageMB); + } + return this; + } + + @Override + public ElasticPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public ElasticPoolImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolInner.java new file mode 100644 index 0000000000000..a07689e4ff810 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolInner.java @@ -0,0 +1,229 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolState; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Represents a database elastic pool. + */ +@JsonFlatten +public class ElasticPoolInner extends Resource { + /** + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The state of the elastic pool. Possible values include: 'Creating', + * 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /** + * The edition of the elastic pool. Possible values include: 'Basic', + * 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.edition") + private ElasticPoolEdition edition; + + /** + * The total shared DTU for the database elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Integer dtu; + + /** + * The maximum DTU any one database can consume. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Integer databaseDtuMax; + + /** + * The minimum DTU all databases are guaranteed. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Integer databaseDtuMin; + + /** + * Gets storage limit for the database elastic pool in MB. + */ + @JsonProperty(value = "properties.storageMB") + private Integer storageMB; + + /** + * Whether or not this database elastic pool is zone redundant, which means + * the replicas of this database will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Kind of elastic pool. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled'. + * + * @return the state value + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the edition value + */ + public ElasticPoolEdition edition() { + return this.edition; + } + + /** + * Set the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @param edition the edition value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withEdition(ElasticPoolEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the total shared DTU for the database elastic pool. + * + * @return the dtu value + */ + public Integer dtu() { + return this.dtu; + } + + /** + * Set the total shared DTU for the database elastic pool. + * + * @param dtu the dtu value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDtu(Integer dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the maximum DTU any one database can consume. + * + * @return the databaseDtuMax value + */ + public Integer databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the maximum DTU any one database can consume. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDatabaseDtuMax(Integer databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get the minimum DTU all databases are guaranteed. + * + * @return the databaseDtuMin value + */ + public Integer databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the minimum DTU all databases are guaranteed. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDatabaseDtuMin(Integer databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get gets storage limit for the database elastic pool in MB. + * + * @return the storageMB value + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set gets storage limit for the database elastic pool in MB. + * + * @param storageMB the storageMB value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..aea59fae7ed1c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPools; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPool; + +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 ElasticPoolImpl define(String name) { + return wrapModel(name); + } + + private ElasticPoolImpl wrapModel(ElasticPoolInner inner) { + return new ElasticPoolImpl(inner, manager()); + } + + private ElasticPoolImpl wrapModel(String name) { + return new ElasticPoolImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ElasticPoolsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1() { + @Override + public ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, elasticPoolName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java new file mode 100644 index 0000000000000..e4d2a1955e77c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java @@ -0,0 +1,741 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolUpdate; +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.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.v2014_04_01.ElasticPools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolInner 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.v2014_04_01.ElasticPools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolInner 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.v2014_04_01.ElasticPools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolUpdate 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.v2014_04_01.ElasticPools beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolUpdate 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.v2014_04_01.ElasticPools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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.v2014_04_01.ElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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.v2014_04_01.ElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools") + 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); + + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic 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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner createOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic 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 createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic 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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new elastic pool or updates an existing 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 be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, 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); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic 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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner update(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic 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 updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic 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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic 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 beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing 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 be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), parameters, 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); + } + + /** + * Deletes the 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 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 serverName, String elasticPoolName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Deletes the 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 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 serverName, String elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes the 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 be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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 be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets 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 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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Gets 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 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 getAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Gets 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, 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); + } + + /** + * Returns a list of elastic pools in 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 List<ElasticPoolInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns a list of elastic pools in 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns a list of elastic pools in 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 List<ElasticPoolInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of elastic pools in 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 List<ElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..65010f09c7ede --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleImpl.java @@ -0,0 +1,126 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class FirewallRuleImpl extends CreatableUpdatableImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String firewallRuleName; + + FirewallRuleImpl(String name, SqlManager manager) { + super(name, new FirewallRuleInner()); + this.manager = manager; + // Set resource name + this.firewallRuleName = name; + // + } + + FirewallRuleImpl(FirewallRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.firewallRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.firewallRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "firewallRules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.getAsync(this.resourceGroupName, this.serverName, this.firewallRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String endIpAddress() { + return this.inner().endIpAddress(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String startIpAddress() { + return this.inner().startIpAddress(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.inner().withEndIpAddress(endIpAddress); + return this; + } + + @Override + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.inner().withStartIpAddress(startIpAddress); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleInner.java new file mode 100644 index 0000000000000..882909f48b09a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleInner.java @@ -0,0 +1,105 @@ +/** + * 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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a server firewall rule. + */ +@JsonFlatten +public class FirewallRuleInner extends ProxyResource { + /** + * Kind of server that contains this firewall rule. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The start IP address of the firewall rule. Must be IPv4 format. Use + * value '0.0.0.0' to represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.startIpAddress", required = true) + private String startIpAddress; + + /** + * The end IP address of the firewall rule. Must be IPv4 format. Must be + * greater than or equal to startIpAddress. Use value '0.0.0.0' to + * represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.endIpAddress", required = true) + private String endIpAddress; + + /** + * Get kind of server that contains this firewall rule. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get location of the server that contains this firewall rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the startIpAddress value + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param startIpAddress the startIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the endIpAddress value + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param endIpAddress the endIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..0ab505ff34941 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRule; + +class FirewallRulesImpl extends WrapperImpl implements FirewallRules { + private final SqlManager manager; + + FirewallRulesImpl(SqlManager manager) { + super(manager.inner().firewallRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public FirewallRuleImpl define(String name) { + return wrapModel(name); + } + + private FirewallRuleImpl wrapModel(FirewallRuleInner inner) { + return new FirewallRuleImpl(inner, manager()); + } + + private FirewallRuleImpl wrapModel(String name) { + return new FirewallRuleImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + FirewallRulesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, firewallRuleName) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, firewallRuleName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java new file mode 100644 index 0000000000000..2fd6243725c4e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java @@ -0,0 +1,456 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in FirewallRules. + */ +public class FirewallRulesInner { + /** The Retrofit service to perform REST calls. */ + private FirewallRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(FirewallRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallRules to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.FirewallRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Body FirewallRuleInner 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.v2014_04_01.FirewallRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @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.v2014_04_01.FirewallRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @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.v2014_04_01.FirewallRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules") + 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); + + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 firewallRuleName, FirewallRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, this.client.apiVersion(), parameters, 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 a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, 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); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/IdParsingUtils.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..3e2876d3a0a90 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2014_04_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseImpl.java new file mode 100644 index 0000000000000..3e57bcdbd399f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseImpl.java @@ -0,0 +1,219 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ImportExportResponse; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ImportExtensionRequest; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2014_04_01.AuthenticationType; +import com.microsoft.azure.management.sql.v2014_04_01.StorageKeyType; +import rx.functions.Func1; + +class ImportExportResponseImpl extends CreatableUpdatableImpl implements ImportExportResponse, ImportExportResponse.Definition, ImportExportResponse.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private ImportExtensionRequest createOrUpdateParameter; + + ImportExportResponseImpl(String name, SqlManager manager) { + super(name, new ImportExportResponseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + ImportExportResponseImpl(ImportExportResponseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createImportOperationAsync(this.resourceGroupName, this.serverName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public ImportExportResponseInner call(ImportExportResponseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createImportOperationAsync(this.resourceGroupName, this.serverName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public ImportExportResponseInner call(ImportExportResponseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + @Override + public String blobUri() { + return this.inner().blobUri(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String queuedTime() { + return this.inner().queuedTime(); + } + + @Override + public UUID requestId() { + return this.inner().requestId(); + } + + @Override + public String requestType() { + return this.inner().requestType(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ImportExportResponseImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public ImportExportResponseImpl withAdministratorLogin(String administratorLogin) { + this.createOrUpdateParameter.withAdministratorLogin(administratorLogin); + return this; + } + + @Override + public ImportExportResponseImpl withAdministratorLoginPassword(String administratorLoginPassword) { + this.createOrUpdateParameter.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + @Override + public ImportExportResponseImpl withOperationMode(String operationMode) { + this.createOrUpdateParameter.withOperationMode(operationMode); + return this; + } + + @Override + public ImportExportResponseImpl withStorageKey(String storageKey) { + this.createOrUpdateParameter.withStorageKey(storageKey); + return this; + } + + @Override + public ImportExportResponseImpl withStorageKeyType(StorageKeyType storageKeyType) { + this.createOrUpdateParameter.withStorageKeyType(storageKeyType); + return this; + } + + @Override + public ImportExportResponseImpl withStorageUri(String storageUri) { + this.createOrUpdateParameter.withStorageUri(storageUri); + return this; + } + + @Override + public ImportExportResponseImpl withAuthenticationType(AuthenticationType authenticationType) { + this.createOrUpdateParameter.withAuthenticationType(authenticationType); + return this; + } + + @Override + public ImportExportResponseImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + + @Override + public ImportExportResponseImpl withType(String type) { + this.createOrUpdateParameter.withType(type); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseInner.java new file mode 100644 index 0000000000000..205cb55da1747 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseInner.java @@ -0,0 +1,156 @@ +/** + * 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.v2014_04_01.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Response for Import/Export Get operation. + */ +@JsonFlatten +public class ImportExportResponseInner extends ProxyResource { + /** + * The request type of the operation. + */ + @JsonProperty(value = "properties.requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /** + * The request type of the operation. + */ + @JsonProperty(value = "properties.requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /** + * The name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The status message returned from the server. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The operation status last modified time. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /** + * The operation queued time. + */ + @JsonProperty(value = "properties.queuedTime", access = JsonProperty.Access.WRITE_ONLY) + private String queuedTime; + + /** + * The blob uri. + */ + @JsonProperty(value = "properties.blobUri", access = JsonProperty.Access.WRITE_ONLY) + private String blobUri; + + /** + * The error message returned from the server. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * Get the request type of the operation. + * + * @return the requestType value + */ + public String requestType() { + return this.requestType; + } + + /** + * Get the request type of the operation. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the name of the database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the status message returned from the server. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the operation status last modified time. + * + * @return the lastModifiedTime value + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the operation queued time. + * + * @return the queuedTime value + */ + public String queuedTime() { + return this.queuedTime; + } + + /** + * Get the blob uri. + * + * @return the blobUri value + */ + public String blobUri() { + return this.blobUri; + } + + /** + * Get the error message returned from the server. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/PageImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..0a52f2fa78a9d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolImpl.java new file mode 100644 index 0000000000000..b6358db3c0748 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolImpl.java @@ -0,0 +1,130 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPool; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v2014_04_01.Database; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; +import org.joda.time.DateTime; + +class RecommendedElasticPoolImpl extends IndexableRefreshableWrapperImpl implements RecommendedElasticPool { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String recommendedElasticPoolName; + + RecommendedElasticPoolImpl(RecommendedElasticPoolInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.recommendedElasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendedElasticPools"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecommendedElasticPoolsInner client = this.manager().inner().recommendedElasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.recommendedElasticPoolName); + } + + + + @Override + public Double databaseDtuMax() { + return this.inner().databaseDtuMax(); + } + + @Override + public Double databaseDtuMin() { + return this.inner().databaseDtuMin(); + } + + @Override + public ElasticPoolEdition databaseEdition() { + return this.inner().databaseEdition(); + } + + @Override + public List databases() { + List lst = new ArrayList(); + if (this.inner().databases() != null) { + for (DatabaseInner inner : this.inner().databases()) { + lst.add( new DatabaseImpl(inner, manager())); + } + } + return lst; + } + + @Override + public Double dtu() { + return this.inner().dtu(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double maxObservedDtu() { + return this.inner().maxObservedDtu(); + } + + @Override + public Double maxObservedStorageMB() { + return this.inner().maxObservedStorageMB(); + } + + @Override + public List metrics() { + List lst = new ArrayList(); + if (this.inner().metrics() != null) { + for (RecommendedElasticPoolMetricInner inner : this.inner().metrics()) { + lst.add( new RecommendedElasticPoolMetricImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime observationPeriodEnd() { + return this.inner().observationPeriodEnd(); + } + + @Override + public DateTime observationPeriodStart() { + return this.inner().observationPeriodStart(); + } + + @Override + public Double storageMB() { + return this.inner().storageMB(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java new file mode 100644 index 0000000000000..4f9e68cc60c45 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java @@ -0,0 +1,234 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +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; + +/** + * Represents a recommented elastic pool. + */ +@JsonFlatten +public class RecommendedElasticPoolInner extends ProxyResource { + /** + * The edition of the recommended elastic pool. The ElasticPoolEdition + * enumeration contains all the valid editions. Possible values include: + * 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.databaseEdition", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolEdition databaseEdition; + + /** + * The DTU for the recommended elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Double dtu; + + /** + * The minimum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Double databaseDtuMin; + + /** + * The maximum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Double databaseDtuMax; + + /** + * Gets storage size in megabytes. + */ + @JsonProperty(value = "properties.storageMB") + private Double storageMB; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodStart; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodEnd; + + /** + * Gets maximum observed DTU. + */ + @JsonProperty(value = "properties.maxObservedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedDtu; + + /** + * Gets maximum observed storage in megabytes. + */ + @JsonProperty(value = "properties.maxObservedStorageMB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedStorageMB; + + /** + * The list of databases in this pool. Expanded property. + */ + @JsonProperty(value = "properties.databases", access = JsonProperty.Access.WRITE_ONLY) + private List databases; + + /** + * The list of databases housed in the server. Expanded property. + */ + @JsonProperty(value = "properties.metrics", access = JsonProperty.Access.WRITE_ONLY) + private List metrics; + + /** + * Get the edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the databaseEdition value + */ + public ElasticPoolEdition databaseEdition() { + return this.databaseEdition; + } + + /** + * Get the DTU for the recommended elastic pool. + * + * @return the dtu value + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set the DTU for the recommended elastic pool. + * + * @param dtu the dtu value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the minimum DTU for the database. + * + * @return the databaseDtuMin value + */ + public Double databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the minimum DTU for the database. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMin(Double databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get the maximum DTU for the database. + * + * @return the databaseDtuMax value + */ + public Double databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the maximum DTU for the database. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMax(Double databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get gets storage size in megabytes. + * + * @return the storageMB value + */ + public Double storageMB() { + return this.storageMB; + } + + /** + * Set gets storage size in megabytes. + * + * @param storageMB the storageMB value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withStorageMB(Double storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodStart value + */ + public DateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value + */ + public DateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get gets maximum observed DTU. + * + * @return the maxObservedDtu value + */ + public Double maxObservedDtu() { + return this.maxObservedDtu; + } + + /** + * Get gets maximum observed storage in megabytes. + * + * @return the maxObservedStorageMB value + */ + public Double maxObservedStorageMB() { + return this.maxObservedStorageMB; + } + + /** + * Get the list of databases in this pool. Expanded property. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Get the list of databases housed in the server. Expanded property. + * + * @return the metrics value + */ + public List metrics() { + return this.metrics; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricImpl.java new file mode 100644 index 0000000000000..3065c0517cfab --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricImpl.java @@ -0,0 +1,46 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class RecommendedElasticPoolMetricImpl extends WrapperImpl implements RecommendedElasticPoolMetric { + private final SqlManager manager; + + RecommendedElasticPoolMetricImpl(RecommendedElasticPoolMetricInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime dateTimeProperty() { + return this.inner().dateTimeProperty(); + } + + @Override + public Double dtu() { + return this.inner().dtu(); + } + + @Override + public Double sizeGB() { + return this.inner().sizeGB(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricInner.java new file mode 100644 index 0000000000000..b1332d083abff --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricInner.java @@ -0,0 +1,97 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents recommended elastic pool metric. + */ +public class RecommendedElasticPoolMetricInner { + /** + * The time of metric (ISO8601 format). + */ + @JsonProperty(value = "dateTime") + private DateTime dateTimeProperty; + + /** + * Gets or sets the DTUs (Database Transaction Units). See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + */ + @JsonProperty(value = "dtu") + private Double dtu; + + /** + * Gets or sets size in gigabytes. + */ + @JsonProperty(value = "sizeGB") + private Double sizeGB; + + /** + * Get the time of metric (ISO8601 format). + * + * @return the dateTimeProperty value + */ + public DateTime dateTimeProperty() { + return this.dateTimeProperty; + } + + /** + * Set the time of metric (ISO8601 format). + * + * @param dateTimeProperty the dateTimeProperty value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDateTimeProperty(DateTime dateTimeProperty) { + this.dateTimeProperty = dateTimeProperty; + return this; + } + + /** + * Get gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @return the dtu value + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @param dtu the dtu value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get gets or sets size in gigabytes. + * + * @return the sizeGB value + */ + public Double sizeGB() { + return this.sizeGB; + } + + /** + * Set gets or sets size in gigabytes. + * + * @param sizeGB the sizeGB value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withSizeGB(Double sizeGB) { + this.sizeGB = sizeGB; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsImpl.java new file mode 100644 index 0000000000000..6140596fbe34d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPool; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; + +class RecommendedElasticPoolsImpl extends WrapperImpl implements RecommendedElasticPools { + private final SqlManager manager; + + RecommendedElasticPoolsImpl(SqlManager manager) { + super(manager.inner().recommendedElasticPools()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RecommendedElasticPoolImpl wrapModel(RecommendedElasticPoolInner inner) { + return new RecommendedElasticPoolImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecommendedElasticPool call(RecommendedElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .map(new Func1() { + @Override + public RecommendedElasticPool call(RecommendedElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + private RecommendedElasticPoolMetricImpl wrapRecommendedElasticPoolMetricModel(RecommendedElasticPoolMetricInner inner) { + return new RecommendedElasticPoolMetricImpl(inner, manager()); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecommendedElasticPoolMetric call(RecommendedElasticPoolMetricInner inner) { + return wrapRecommendedElasticPoolMetricModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java new file mode 100644 index 0000000000000..e5c6cca5a3293 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java @@ -0,0 +1,351 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RecommendedElasticPools. + */ +public class RecommendedElasticPoolsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendedElasticPoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedElasticPoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendedElasticPoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecommendedElasticPoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecommendedElasticPools to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendedElasticPoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @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.v2014_04_01.RecommendedElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools") + 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.v2014_04_01.RecommendedElasticPools listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic 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 RecommendedElasticPoolInner object if successful. + */ + public RecommendedElasticPoolInner get(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic 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 getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1, RecommendedElasticPoolInner>() { + @Override + public RecommendedElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + 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 (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, 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); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic 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 List<RecommendedElasticPoolMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic 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> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedElasticPoolMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedElasticPoolMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + 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 (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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.listMetrics(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkImpl.java new file mode 100644 index 0000000000000..f551a050b6f5f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLink; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationRole; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationState; +import org.joda.time.DateTime; + +class ReplicationLinkImpl extends IndexableRefreshableWrapperImpl implements ReplicationLink { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String linkId; + + ReplicationLinkImpl(ReplicationLinkInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.linkId = IdParsingUtils.getValueFromIdByName(inner.id(), "replicationLinks"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ReplicationLinksInner client = this.manager().inner().replicationLinks(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.linkId); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isTerminationAllowed() { + return this.inner().isTerminationAllowed(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerDatabase() { + return this.inner().partnerDatabase(); + } + + @Override + public String partnerLocation() { + return this.inner().partnerLocation(); + } + + @Override + public ReplicationRole partnerRole() { + return this.inner().partnerRole(); + } + + @Override + public String partnerServer() { + return this.inner().partnerServer(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String replicationMode() { + return this.inner().replicationMode(); + } + + @Override + public ReplicationState replicationState() { + return this.inner().replicationState(); + } + + @Override + public ReplicationRole role() { + return this.inner().role(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkInner.java new file mode 100644 index 0000000000000..5c09c6fe8df96 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkInner.java @@ -0,0 +1,194 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationRole; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database replication link. + */ +@JsonFlatten +public class ReplicationLinkInner extends ProxyResource { + /** + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Legacy value indicating whether termination is allowed. Currently + * always returns true. + */ + @JsonProperty(value = "properties.isTerminationAllowed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTerminationAllowed; + + /** + * Replication mode of this replication link. + */ + @JsonProperty(value = "properties.replicationMode", access = JsonProperty.Access.WRITE_ONLY) + private String replicationMode; + + /** + * The name of the server hosting the partner database. + */ + @JsonProperty(value = "properties.partnerServer", access = JsonProperty.Access.WRITE_ONLY) + private String partnerServer; + + /** + * The name of the partner database. + */ + @JsonProperty(value = "properties.partnerDatabase", access = JsonProperty.Access.WRITE_ONLY) + private String partnerDatabase; + + /** + * The Azure Region of the partner database. + */ + @JsonProperty(value = "properties.partnerLocation", access = JsonProperty.Access.WRITE_ONLY) + private String partnerLocation; + + /** + * The role of the database in the replication link. Possible values + * include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', + * 'Copy'. + */ + @JsonProperty(value = "properties.role", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole role; + + /** + * The role of the partner database in the replication link. Possible + * values include: 'Primary', 'Secondary', 'NonReadableSecondary', + * 'Source', 'Copy'. + */ + @JsonProperty(value = "properties.partnerRole", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole partnerRole; + + /** + * The start time for the replication link. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The percentage of seeding complete for the replication link. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The replication state for the replication link. Possible values include: + * 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED'. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationState replicationState; + + /** + * Get location of the server that contains this firewall rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get legacy value indicating whether termination is allowed. Currently always returns true. + * + * @return the isTerminationAllowed value + */ + public Boolean isTerminationAllowed() { + return this.isTerminationAllowed; + } + + /** + * Get replication mode of this replication link. + * + * @return the replicationMode value + */ + public String replicationMode() { + return this.replicationMode; + } + + /** + * Get the name of the server hosting the partner database. + * + * @return the partnerServer value + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Get the name of the partner database. + * + * @return the partnerDatabase value + */ + public String partnerDatabase() { + return this.partnerDatabase; + } + + /** + * Get the Azure Region of the partner database. + * + * @return the partnerLocation value + */ + public String partnerLocation() { + return this.partnerLocation; + } + + /** + * Get the role of the database in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy'. + * + * @return the role value + */ + public ReplicationRole role() { + return this.role; + } + + /** + * Get the role of the partner database in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy'. + * + * @return the partnerRole value + */ + public ReplicationRole partnerRole() { + return this.partnerRole; + } + + /** + * Get the start time for the replication link. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the percentage of seeding complete for the replication link. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED'. + * + * @return the replicationState value + */ + public ReplicationState replicationState() { + return this.replicationState; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksImpl.java new file mode 100644 index 0000000000000..094b92744f79d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLinks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLink; + +class ReplicationLinksImpl extends WrapperImpl implements ReplicationLinks { + private final SqlManager manager; + + ReplicationLinksImpl(SqlManager manager) { + super(manager.inner().replicationLinks()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ReplicationLinkImpl wrapModel(ReplicationLinkInner inner) { + return new ReplicationLinkImpl(inner, manager()); + } + + @Override + public Completable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + + @Override + public Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.failoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + ReplicationLinksInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReplicationLink call(ReplicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, linkId) + .map(new Func1() { + @Override + public ReplicationLink call(ReplicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java new file mode 100644 index 0000000000000..a4cb1d8c51849 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java @@ -0,0 +1,749 @@ +/** + * 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.v2014_04_01.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 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.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 ReplicationLinks. + */ +public class ReplicationLinksInner { + /** The Retrofit service to perform REST calls. */ + private ReplicationLinksService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ReplicationLinksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReplicationLinksInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ReplicationLinksService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReplicationLinks to be + * used by Retrofit to perform actually REST calls. + */ + interface ReplicationLinksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ReplicationLinks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + Observable> failover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + Observable> beginFailover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks failoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + Observable> failoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks beginFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + Observable> beginFailoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link 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 serverName, String databaseName, String linkId) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link 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 serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID 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 ReplicationLinkInner object if successful. + */ + public ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID 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 getAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationLinkInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, ReplicationLinkInner>() { + @Override + public ReplicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationLinkInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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 which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId) { + failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId) { + beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.failoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.beginFailoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverAllowDataLossDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @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 List<ReplicationLinkInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReplicationLinkInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReplicationLinkInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java new file mode 100644 index 0000000000000..fb29786e42b3b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Servers; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityResponse; + +class ServersImpl extends WrapperImpl implements Servers { + private final SqlManager manager; + + ServersImpl(SqlManager manager) { + super(manager.inner().servers()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable checkNameAvailabilityAsync(String name) { + ServersInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResponse call(CheckNameAvailabilityResponseInner inner) { + return new CheckNameAvailabilityResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java new file mode 100644 index 0000000000000..ae53681ce9724 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java @@ -0,0 +1,143 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityRequest; +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.Body; +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 Servers. + */ +public class ServersInner { + /** The Retrofit service to perform REST calls. */ + private ServersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Servers to be + * used by Retrofit to perform actually REST calls. + */ + interface ServersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Servers checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityRequest parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @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 CheckNameAvailabilityResponseInner object if successful. + */ + public CheckNameAvailabilityResponseInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @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 checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResponseInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityResponseInner>() { + @Override + public CheckNameAvailabilityResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResponseInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + 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 (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailabilityRequest parameters = new CheckNameAvailabilityRequest(); + parameters.withName(name); + return service.checkNameAvailability(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 = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorImpl.java new file mode 100644 index 0000000000000..7654387ba6009 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorImpl.java @@ -0,0 +1,158 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisor; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.SloUsageMetric; + +class ServiceTierAdvisorImpl extends IndexableRefreshableWrapperImpl implements ServiceTierAdvisor { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String serviceTierAdvisorName; + + ServiceTierAdvisorImpl(ServiceTierAdvisorInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.serviceTierAdvisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "serviceTierAdvisors"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ServiceTierAdvisorsInner client = this.manager().inner().serviceTierAdvisors(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.serviceTierAdvisorName); + } + + + + @Override + public Double activeTimeRatio() { + return this.inner().activeTimeRatio(); + } + + @Override + public Double avgDtu() { + return this.inner().avgDtu(); + } + + @Override + public double confidence() { + return this.inner().confidence(); + } + + @Override + public String currentServiceLevelObjective() { + return this.inner().currentServiceLevelObjective(); + } + + @Override + public UUID currentServiceLevelObjectiveId() { + return this.inner().currentServiceLevelObjectiveId(); + } + + @Override + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.inner().databaseSizeBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.inner().databaseSizeBasedRecommendationServiceLevelObjectiveId(); + } + + @Override + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.inner().disasterPlanBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.inner().disasterPlanBasedRecommendationServiceLevelObjectiveId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double maxDtu() { + return this.inner().maxDtu(); + } + + @Override + public Double maxSizeInGB() { + return this.inner().maxSizeInGB(); + } + + @Override + public Double minDtu() { + return this.inner().minDtu(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime observationPeriodEnd() { + return this.inner().observationPeriodEnd(); + } + + @Override + public DateTime observationPeriodStart() { + return this.inner().observationPeriodStart(); + } + + @Override + public String overallRecommendationServiceLevelObjective() { + return this.inner().overallRecommendationServiceLevelObjective(); + } + + @Override + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.inner().overallRecommendationServiceLevelObjectiveId(); + } + + @Override + public List serviceLevelObjectiveUsageMetrics() { + return this.inner().serviceLevelObjectiveUsageMetrics(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String usageBasedRecommendationServiceLevelObjective() { + return this.inner().usageBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.inner().usageBasedRecommendationServiceLevelObjectiveId(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorInner.java new file mode 100644 index 0000000000000..d2cb90000f19f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorInner.java @@ -0,0 +1,318 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.SloUsageMetric; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a Service Tier Advisor. + */ +@JsonFlatten +public class ServiceTierAdvisorInner extends ProxyResource { + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodStart; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodEnd; + + /** + * The activeTimeRatio for service tier advisor. + */ + @JsonProperty(value = "properties.activeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private Double activeTimeRatio; + + /** + * Gets or sets minDtu for service tier advisor. + */ + @JsonProperty(value = "properties.minDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double minDtu; + + /** + * Gets or sets avgDtu for service tier advisor. + */ + @JsonProperty(value = "properties.avgDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double avgDtu; + + /** + * Gets or sets maxDtu for service tier advisor. + */ + @JsonProperty(value = "properties.maxDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxDtu; + + /** + * Gets or sets maxSizeInGB for service tier advisor. + */ + @JsonProperty(value = "properties.maxSizeInGB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxSizeInGB; + + /** + * Gets or sets serviceLevelObjectiveUsageMetrics for the service tier + * advisor. + */ + @JsonProperty(value = "properties.serviceLevelObjectiveUsageMetrics", access = JsonProperty.Access.WRITE_ONLY) + private List serviceLevelObjectiveUsageMetrics; + + /** + * Gets or sets currentServiceLevelObjective for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceLevelObjective; + + /** + * Gets or sets currentServiceLevelObjectiveId for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceLevelObjectiveId; + + /** + * Gets or sets usageBasedRecommendationServiceLevelObjective for service + * tier advisor. + */ + @JsonProperty(value = "properties.usageBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String usageBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty(value = "properties.usageBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID usageBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty(value = "properties.databaseSizeBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String databaseSizeBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty(value = "properties.databaseSizeBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseSizeBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty(value = "properties.disasterPlanBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String disasterPlanBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty(value = "properties.disasterPlanBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID disasterPlanBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets overallRecommendationServiceLevelObjective for service tier + * advisor. + */ + @JsonProperty(value = "properties.overallRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String overallRecommendationServiceLevelObjective; + + /** + * Gets or sets overallRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty(value = "properties.overallRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID overallRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets confidence for service tier advisor. + */ + @JsonProperty(value = "properties.confidence", access = JsonProperty.Access.WRITE_ONLY) + private double confidence; + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodStart value + */ + public DateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value + */ + public DateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get the activeTimeRatio for service tier advisor. + * + * @return the activeTimeRatio value + */ + public Double activeTimeRatio() { + return this.activeTimeRatio; + } + + /** + * Get gets or sets minDtu for service tier advisor. + * + * @return the minDtu value + */ + public Double minDtu() { + return this.minDtu; + } + + /** + * Get gets or sets avgDtu for service tier advisor. + * + * @return the avgDtu value + */ + public Double avgDtu() { + return this.avgDtu; + } + + /** + * Get gets or sets maxDtu for service tier advisor. + * + * @return the maxDtu value + */ + public Double maxDtu() { + return this.maxDtu; + } + + /** + * Get gets or sets maxSizeInGB for service tier advisor. + * + * @return the maxSizeInGB value + */ + public Double maxSizeInGB() { + return this.maxSizeInGB; + } + + /** + * Get gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. + * + * @return the serviceLevelObjectiveUsageMetrics value + */ + public List serviceLevelObjectiveUsageMetrics() { + return this.serviceLevelObjectiveUsageMetrics; + } + + /** + * Get gets or sets currentServiceLevelObjective for service tier advisor. + * + * @return the currentServiceLevelObjective value + */ + public String currentServiceLevelObjective() { + return this.currentServiceLevelObjective; + } + + /** + * Get gets or sets currentServiceLevelObjectiveId for service tier advisor. + * + * @return the currentServiceLevelObjectiveId value + */ + public UUID currentServiceLevelObjectiveId() { + return this.currentServiceLevelObjectiveId; + } + + /** + * Get gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjective value + */ + public String usageBasedRecommendationServiceLevelObjective() { + return this.usageBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjectiveId value + */ + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.usageBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjective value + */ + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.databaseSizeBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value + */ + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.databaseSizeBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjective value + */ + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.disasterPlanBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value + */ + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.disasterPlanBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets overallRecommendationServiceLevelObjective for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjective value + */ + public String overallRecommendationServiceLevelObjective() { + return this.overallRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjectiveId value + */ + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.overallRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets confidence for service tier advisor. + * + * @return the confidence value + */ + public double confidence() { + return this.confidence; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsImpl.java new file mode 100644 index 0000000000000..18d3f380e3259 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisors; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisor; + +class ServiceTierAdvisorsImpl extends WrapperImpl implements ServiceTierAdvisors { + private final SqlManager manager; + + ServiceTierAdvisorsImpl(SqlManager manager) { + super(manager.inner().serviceTierAdvisors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServiceTierAdvisorImpl wrapModel(ServiceTierAdvisorInner inner) { + return new ServiceTierAdvisorImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + ServiceTierAdvisorsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServiceTierAdvisor call(ServiceTierAdvisorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + ServiceTierAdvisorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName) + .map(new Func1() { + @Override + public ServiceTierAdvisor call(ServiceTierAdvisorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java new file mode 100644 index 0000000000000..82868d139f4e2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java @@ -0,0 +1,263 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServiceTierAdvisors. + */ +public class ServiceTierAdvisorsInner { + /** The Retrofit service to perform REST calls. */ + private ServiceTierAdvisorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceTierAdvisorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServiceTierAdvisorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServiceTierAdvisorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServiceTierAdvisors to be + * used by Retrofit to perform actually REST calls. + */ + interface ServiceTierAdvisorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("serviceTierAdvisorName") String serviceTierAdvisorName, @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.v2014_04_01.ServiceTierAdvisors listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 ServiceTierAdvisorInner object if successful. + */ + public ServiceTierAdvisorInner get(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).toBlocking().single().body(); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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, String serviceTierAdvisorName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName), serviceCallback); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceTierAdvisorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).map(new Func1, ServiceTierAdvisorInner>() { + @Override + public ServiceTierAdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceTierAdvisorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (serviceTierAdvisorName == null) { + throw new IllegalArgumentException("Parameter serviceTierAdvisorName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, serviceTierAdvisorName, 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); + } + + /** + * Returns service tier advisors for specified 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 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 List<ServiceTierAdvisorInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns service tier advisors for specified 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 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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServiceTierAdvisorInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServiceTierAdvisorInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..ddb7d43009f90 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java @@ -0,0 +1,350 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ServersInner object to access its operations. + */ + private ServersInner servers; + + /** + * Gets the ServersInner object to access its operations. + * @return the ServersInner object. + */ + public ServersInner servers() { + return this.servers; + } + + /** + * 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 FirewallRulesInner object to access its operations. + */ + private FirewallRulesInner firewallRules; + + /** + * Gets the FirewallRulesInner object to access its operations. + * @return the FirewallRulesInner object. + */ + public FirewallRulesInner firewallRules() { + return this.firewallRules; + } + + /** + * The RecommendedElasticPoolsInner object to access its operations. + */ + private RecommendedElasticPoolsInner recommendedElasticPools; + + /** + * Gets the RecommendedElasticPoolsInner object to access its operations. + * @return the RecommendedElasticPoolsInner object. + */ + public RecommendedElasticPoolsInner recommendedElasticPools() { + return this.recommendedElasticPools; + } + + /** + * The ReplicationLinksInner object to access its operations. + */ + private ReplicationLinksInner replicationLinks; + + /** + * Gets the ReplicationLinksInner object to access its operations. + * @return the ReplicationLinksInner object. + */ + public ReplicationLinksInner replicationLinks() { + return this.replicationLinks; + } + + /** + * The ElasticPoolActivitiesInner object to access its operations. + */ + private ElasticPoolActivitiesInner elasticPoolActivities; + + /** + * Gets the ElasticPoolActivitiesInner object to access its operations. + * @return the ElasticPoolActivitiesInner object. + */ + public ElasticPoolActivitiesInner elasticPoolActivities() { + return this.elasticPoolActivities; + } + + /** + * The ElasticPoolDatabaseActivitiesInner object to access its operations. + */ + private ElasticPoolDatabaseActivitiesInner elasticPoolDatabaseActivities; + + /** + * Gets the ElasticPoolDatabaseActivitiesInner object to access its operations. + * @return the ElasticPoolDatabaseActivitiesInner object. + */ + public ElasticPoolDatabaseActivitiesInner elasticPoolDatabaseActivities() { + return this.elasticPoolDatabaseActivities; + } + + /** + * The ServiceTierAdvisorsInner object to access its operations. + */ + private ServiceTierAdvisorsInner serviceTierAdvisors; + + /** + * Gets the ServiceTierAdvisorsInner object to access its operations. + * @return the ServiceTierAdvisorsInner object. + */ + public ServiceTierAdvisorsInner serviceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** + * The TransparentDataEncryptionsInner object to access its operations. + */ + private TransparentDataEncryptionsInner transparentDataEncryptions; + + /** + * Gets the TransparentDataEncryptionsInner object to access its operations. + * @return the TransparentDataEncryptionsInner object. + */ + public TransparentDataEncryptionsInner transparentDataEncryptions() { + return this.transparentDataEncryptions; + } + + /** + * The TransparentDataEncryptionActivitiesInner object to access its operations. + */ + private TransparentDataEncryptionActivitiesInner transparentDataEncryptionActivities; + + /** + * Gets the TransparentDataEncryptionActivitiesInner object to access its operations. + * @return the TransparentDataEncryptionActivitiesInner object. + */ + public TransparentDataEncryptionActivitiesInner transparentDataEncryptionActivities() { + return this.transparentDataEncryptionActivities; + } + + /** + * The DatabaseThreatDetectionPoliciesInner object to access its operations. + */ + private DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies; + + /** + * Gets the DatabaseThreatDetectionPoliciesInner object to access its operations. + * @return the DatabaseThreatDetectionPoliciesInner object. + */ + public DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies() { + return this.databaseThreatDetectionPolicies; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2014-04-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.servers = new ServersInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); + this.firewallRules = new FirewallRulesInner(restClient().retrofit(), this); + this.recommendedElasticPools = new RecommendedElasticPoolsInner(restClient().retrofit(), this); + this.replicationLinks = new ReplicationLinksInner(restClient().retrofit(), this); + this.elasticPoolActivities = new ElasticPoolActivitiesInner(restClient().retrofit(), this); + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesInner(restClient().retrofit(), this); + this.serviceTierAdvisors = new ServiceTierAdvisorsInner(restClient().retrofit(), this); + this.transparentDataEncryptions = new TransparentDataEncryptionsInner(restClient().retrofit(), this); + this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesInner(restClient().retrofit(), this); + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2014-04-01"); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java new file mode 100644 index 0000000000000..48bcb3d5c4a75 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java @@ -0,0 +1,231 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2014_04_01.Servers; +import com.microsoft.azure.management.sql.v2014_04_01.Databases; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPools; +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRules; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLinks; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivities; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivities; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisors; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivities; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private Servers servers; + private Databases databases; + private ElasticPools elasticPools; + private FirewallRules firewallRules; + private RecommendedElasticPools recommendedElasticPools; + private ReplicationLinks replicationLinks; + private ElasticPoolActivities elasticPoolActivities; + private ElasticPoolDatabaseActivities elasticPoolDatabaseActivities; + private ServiceTierAdvisors serviceTierAdvisors; + private TransparentDataEncryptions transparentDataEncryptions; + private TransparentDataEncryptionActivities transparentDataEncryptionActivities; + private DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Servers. + */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(this); + } + return this.servers; + } + + /** + * @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 FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(this); + } + return this.firewallRules; + } + + /** + * @return Entry point to manage RecommendedElasticPools. + */ + public RecommendedElasticPools recommendedElasticPools() { + if (this.recommendedElasticPools == null) { + this.recommendedElasticPools = new RecommendedElasticPoolsImpl(this); + } + return this.recommendedElasticPools; + } + + /** + * @return Entry point to manage ReplicationLinks. + */ + public ReplicationLinks replicationLinks() { + if (this.replicationLinks == null) { + this.replicationLinks = new ReplicationLinksImpl(this); + } + return this.replicationLinks; + } + + /** + * @return Entry point to manage ElasticPoolActivities. + */ + public ElasticPoolActivities elasticPoolActivities() { + if (this.elasticPoolActivities == null) { + this.elasticPoolActivities = new ElasticPoolActivitiesImpl(this); + } + return this.elasticPoolActivities; + } + + /** + * @return Entry point to manage ElasticPoolDatabaseActivities. + */ + public ElasticPoolDatabaseActivities elasticPoolDatabaseActivities() { + if (this.elasticPoolDatabaseActivities == null) { + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesImpl(this); + } + return this.elasticPoolDatabaseActivities; + } + + /** + * @return Entry point to manage ServiceTierAdvisors. + */ + public ServiceTierAdvisors serviceTierAdvisors() { + if (this.serviceTierAdvisors == null) { + this.serviceTierAdvisors = new ServiceTierAdvisorsImpl(this); + } + return this.serviceTierAdvisors; + } + + /** + * @return Entry point to manage TransparentDataEncryptions. + */ + public TransparentDataEncryptions transparentDataEncryptions() { + if (this.transparentDataEncryptions == null) { + this.transparentDataEncryptions = new TransparentDataEncryptionsImpl(this); + } + return this.transparentDataEncryptions; + } + + /** + * @return Entry point to manage TransparentDataEncryptionActivities. + */ + public TransparentDataEncryptionActivities transparentDataEncryptionActivities() { + if (this.transparentDataEncryptionActivities == null) { + this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesImpl(this); + } + return this.transparentDataEncryptionActivities; + } + + /** + * @return Entry point to manage DatabaseThreatDetectionPolicies. + */ + public DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies() { + if (this.databaseThreatDetectionPolicies == null) { + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesImpl(this); + } + return this.databaseThreatDetectionPolicies; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesImpl.java new file mode 100644 index 0000000000000..36994fcb89bf8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivity; + +class TransparentDataEncryptionActivitiesImpl extends WrapperImpl implements TransparentDataEncryptionActivities { + private final SqlManager manager; + + TransparentDataEncryptionActivitiesImpl(SqlManager manager) { + super(manager.inner().transparentDataEncryptionActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionActivitiesInner client = this.inner(); + return client.listByConfigurationAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public TransparentDataEncryptionActivity call(TransparentDataEncryptionActivityInner inner) { + return new TransparentDataEncryptionActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java new file mode 100644 index 0000000000000..61af0ac2e78e8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java @@ -0,0 +1,160 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TransparentDataEncryptionActivities. + */ +public class TransparentDataEncryptionActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private TransparentDataEncryptionActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransparentDataEncryptionActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TransparentDataEncryptionActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TransparentDataEncryptionActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface TransparentDataEncryptionActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivities listByConfiguration" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults") + Observable> listByConfiguration(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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 List<TransparentDataEncryptionActivityInner> object if successful. + */ + public List listByConfiguration(String resourceGroupName, String serverName, String databaseName) { + return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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> listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionActivityInner> object + */ + public Observable> listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName) { + return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionActivityInner> object + */ + public Observable>> listByConfigurationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + return service.listByConfiguration(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByConfigurationDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByConfigurationDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityImpl.java new file mode 100644 index 0000000000000..0c0b0f10946f0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityImpl.java @@ -0,0 +1,57 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivityStatus; + +class TransparentDataEncryptionActivityImpl extends WrapperImpl implements TransparentDataEncryptionActivity { + private final SqlManager manager; + TransparentDataEncryptionActivityImpl(TransparentDataEncryptionActivityInner 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 location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Double percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public TransparentDataEncryptionActivityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityInner.java new file mode 100644 index 0000000000000..720e8ca7803ff --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database transparent data encryption Scan. + */ +@JsonFlatten +public class TransparentDataEncryptionActivityInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The status of the database. Possible values include: 'Encrypting', + * 'Decrypting'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private TransparentDataEncryptionActivityStatus status; + + /** + * The percent complete of the transparent data encryption scan for a + * database. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Double percentComplete; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the status of the database. Possible values include: 'Encrypting', 'Decrypting'. + * + * @return the status value + */ + public TransparentDataEncryptionActivityStatus status() { + return this.status; + } + + /** + * Get the percent complete of the transparent data encryption scan for a database. + * + * @return the percentComplete value + */ + public Double percentComplete() { + return this.percentComplete; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..8e5684f91121d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionImpl.java @@ -0,0 +1,52 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryption; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionStatus; + +class TransparentDataEncryptionImpl extends WrapperImpl implements TransparentDataEncryption { + private final SqlManager manager; + TransparentDataEncryptionImpl(TransparentDataEncryptionInner 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 location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public TransparentDataEncryptionStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..38eb1a8aa63b5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database transparent data encryption configuration. + */ +@JsonFlatten +public class TransparentDataEncryptionInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The status of the database transparent data encryption. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private TransparentDataEncryptionStatus status; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public TransparentDataEncryptionStatus status() { + return this.status; + } + + /** + * Set the status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled'. + * + * @param status the status value to set + * @return the TransparentDataEncryptionInner object itself. + */ + public TransparentDataEncryptionInner withStatus(TransparentDataEncryptionStatus status) { + this.status = status; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsImpl.java new file mode 100644 index 0000000000000..e00a1d23c466e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryption; + +class TransparentDataEncryptionsImpl extends WrapperImpl implements TransparentDataEncryptions { + private final SqlManager manager; + + TransparentDataEncryptionsImpl(SqlManager manager) { + super(manager.inner().transparentDataEncryptions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public TransparentDataEncryption call(TransparentDataEncryptionInner inner) { + return new TransparentDataEncryptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public TransparentDataEncryption call(TransparentDataEncryptionInner inner) { + return new TransparentDataEncryptionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java new file mode 100644 index 0000000000000..e46177c8bb32b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java @@ -0,0 +1,352 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionStatus; +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.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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TransparentDataEncryptions. + */ +public class TransparentDataEncryptionsInner { + /** The Retrofit service to perform REST calls. */ + private TransparentDataEncryptionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransparentDataEncryptionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TransparentDataEncryptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TransparentDataEncryptions to be + * used by Retrofit to perform actually REST calls. + */ + interface TransparentDataEncryptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransparentDataEncryptionInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + final TransparentDataEncryptionStatus status = null; + TransparentDataEncryptionInner parameters = new TransparentDataEncryptionInner(); + parameters.withStatus(null); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status).toBlocking().single().body(); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @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, TransparentDataEncryptionStatus status, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status), serviceCallback); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + TransparentDataEncryptionInner parameters = new TransparentDataEncryptionInner(); + parameters.withStatus(status); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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 transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, 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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/package-info.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/package-info.java new file mode 100644 index 0000000000000..cee659caf32dc --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2014_04_01.implementation; diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/package-info.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/package-info.java new file mode 100644 index 0000000000000..20de3edad10df --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2014_04_01; diff --git a/sql/resource-manager/v2017_10_01_preview/pom.xml b/sql/resource-manager/v2017_10_01_preview/pom.xml new file mode 100644 index 0000000000000..c8dd3d5addf73 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v2017_10_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicies.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..3f82eafccc3f9 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicies.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.v2017_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.BackupShortTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BackupShortTermRetentionPolicies. + */ +public interface BackupShortTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's short 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 serverName The name of the server. + * @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 serverName, String databaseName); + + /** + * Gets a database's short 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 serverName The name of the server. + * @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 serverName, final String databaseName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicy.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..32dcb53fb9d06 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.BackupShortTermRetentionPolicyInner; +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.v2017_10_01_preview.implementation.SqlManager; + +/** + * Type representing BackupShortTermRetentionPolicy. + */ +public interface BackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the BackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the backupshorttermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * 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 { + } + } + /** + * The template for a BackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of BackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Capabilities.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Capabilities.java new file mode 100644 index 0000000000000..07145c4dede45 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Capabilities.java @@ -0,0 +1,26 @@ +/** + * 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.v2017_10_01_preview; + +import rx.Observable; + +/** + * Type representing Capabilities. + */ +public interface Capabilities { + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(String locationName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityGroup.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityGroup.java new file mode 100644 index 0000000000000..5be26e7734d34 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityGroup.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CapabilityGroup. + */ +public final class CapabilityGroup extends ExpandableStringEnum { + /** Static value supportedEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_EDITIONS = fromString("supportedEditions"); + + /** Static value supportedElasticPoolEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_ELASTIC_POOL_EDITIONS = fromString("supportedElasticPoolEditions"); + + /** Static value supportedManagedInstanceVersions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_MANAGED_INSTANCE_VERSIONS = fromString("supportedManagedInstanceVersions"); + + /** + * Creates or finds a CapabilityGroup from its string representation. + * @param name a name to look for + * @return the corresponding CapabilityGroup + */ + @JsonCreator + public static CapabilityGroup fromString(String name) { + return fromString(name, CapabilityGroup.class); + } + + /** + * @return known CapabilityGroup values + */ + public static Collection values() { + return values(CapabilityGroup.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityStatus.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityStatus.java new file mode 100644 index 0000000000000..4306f9745d4fd --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityStatus.java @@ -0,0 +1,59 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CapabilityStatus. + */ +public enum CapabilityStatus { + /** Enum value Visible. */ + VISIBLE("Visible"), + + /** Enum value Available. */ + AVAILABLE("Available"), + + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a CapabilityStatus instance. */ + private String value; + + CapabilityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CapabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed CapabilityStatus object, or null if unable to parse. + */ + @JsonCreator + public static CapabilityStatus fromString(String value) { + CapabilityStatus[] items = CapabilityStatus.values(); + for (CapabilityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CatalogCollationType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CatalogCollationType.java new file mode 100644 index 0000000000000..de060acd99ae8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_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.v2017_10_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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CreateMode.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CreateMode.java new file mode 100644 index 0000000000000..ff711aa5a8ccb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CreateMode.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CreateMode. + */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value Copy for CreateMode. */ + public static final CreateMode COPY = fromString("Copy"); + + /** Static value Secondary for CreateMode. */ + public static final CreateMode SECONDARY = fromString("Secondary"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** Static value Recovery for CreateMode. */ + public static final CreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreExternalBackup for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value RestoreExternalBackupSecondary for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP_SECONDARY = fromString("RestoreExternalBackupSecondary"); + + /** Static value RestoreLongTermRetentionBackup for CreateMode. */ + public static final CreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** Static value OnlineSecondary for CreateMode. */ + public static final CreateMode ONLINE_SECONDARY = fromString("OnlineSecondary"); + + /** + * Creates or finds a CreateMode from its string representation. + * @param name a name to look for + * @return the corresponding CreateMode + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * @return known CreateMode values + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Database.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Database.java new file mode 100644 index 0000000000000..67c6cc9fd40b0 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Database.java @@ -0,0 +1,613 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseInner; +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.v2017_10_01_preview.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing Database. + */ +public interface Database extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the currentServiceObjectiveName value. + */ + String currentServiceObjectiveName(); + + /** + * @return the currentSku value. + */ + Sku currentSku(); + + /** + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the elasticPoolId value. + */ + String elasticPoolId(); + + /** + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the licenseType value. + */ + DatabaseLicenseType licenseType(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the maxLogSizeBytes value. + */ + Long maxLogSizeBytes(); + + /** + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the readScale value. + */ + DatabaseReadScale readScale(); + + /** + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * @return the recoveryServicesRecoveryPointId value. + */ + String recoveryServicesRecoveryPointId(); + + /** + * @return the requestedServiceObjectiveName value. + */ + String requestedServiceObjectiveName(); + + /** + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the sourceDatabaseDeletionDate value. + */ + DateTime sourceDatabaseDeletionDate(); + + /** + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * @return the status value. + */ + DatabaseStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the Database definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Database definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Database definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the database definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the database definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the database definition allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the database definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database definition allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + WithCreate withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(DatabaseLicenseType licenseType); + } + + /** + * The stage of the database definition allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database definition allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + WithCreate withReadScale(DatabaseReadScale readScale); + } + + /** + * The stage of the database definition allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + WithCreate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database definition allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database definition allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + WithCreate withSampleName(SampleName sampleName); + } + + /** + * The stage of the database definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + WithCreate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the database definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithElasticPoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithLongTermRetentionBackupResourceId, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithReadScale, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRecoveryServicesRecoveryPointId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSku, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a Database update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithElasticPoolId, UpdateStages.WithLicenseType, UpdateStages.WithLongTermRetentionBackupResourceId, UpdateStages.WithMaxSizeBytes, UpdateStages.WithReadScale, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRecoveryServicesRecoveryPointId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSku, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of Database update stages. + */ + interface UpdateStages { + /** + * The stage of the database update allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the database update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database update allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + Update withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(DatabaseLicenseType licenseType); + } + + /** + * The stage of the database update allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + Update withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database update allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + Update withReadScale(DatabaseReadScale readScale); + } + + /** + * The stage of the database update allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database update allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + Update withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database update allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database update allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + Update withSampleName(SampleName sampleName); + } + + /** + * The stage of the database update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + Update withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the database update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseLicenseType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseLicenseType.java new file mode 100644 index 0000000000000..95a4681b8d88f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseLicenseType.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseLicenseType. + */ +public final class DatabaseLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for DatabaseLicenseType. */ + public static final DatabaseLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for DatabaseLicenseType. */ + public static final DatabaseLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a DatabaseLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseLicenseType + */ + @JsonCreator + public static DatabaseLicenseType fromString(String name) { + return fromString(name, DatabaseLicenseType.class); + } + + /** + * @return known DatabaseLicenseType values + */ + public static Collection values() { + return values(DatabaseLicenseType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperation.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperation.java new file mode 100644 index 0000000000000..0aead71d2da3f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperation.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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseOperationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing DatabaseOperation. + */ +public interface DatabaseOperation extends HasInner, HasManager { + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @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 name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + ManagementOperationState state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperations.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperations.java new file mode 100644 index 0000000000000..186108b1a4eaa --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperations.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.v2017_10_01_preview; + +import rx.Observable; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseOperations. + */ +public interface DatabaseOperations extends HasInner { + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId); + + /** + * Gets a list of operations performed on the 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. + * @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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseReadScale.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseReadScale.java new file mode 100644 index 0000000000000..4cbd6a8f55270 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseReadScale.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseReadScale. + */ +public final class DatabaseReadScale extends ExpandableStringEnum { + /** Static value Enabled for DatabaseReadScale. */ + public static final DatabaseReadScale ENABLED = fromString("Enabled"); + + /** Static value Disabled for DatabaseReadScale. */ + public static final DatabaseReadScale DISABLED = fromString("Disabled"); + + /** + * Creates or finds a DatabaseReadScale from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseReadScale + */ + @JsonCreator + public static DatabaseReadScale fromString(String name) { + return fromString(name, DatabaseReadScale.class); + } + + /** + * @return known DatabaseReadScale values + */ + public static Collection values() { + return values(DatabaseReadScale.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java new file mode 100644 index 0000000000000..9f978f320c7d2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseStatus. + */ +public final class DatabaseStatus extends ExpandableStringEnum { + /** Static value Online for DatabaseStatus. */ + public static final DatabaseStatus ONLINE = fromString("Online"); + + /** Static value Restoring for DatabaseStatus. */ + public static final DatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value RecoveryPending for DatabaseStatus. */ + public static final DatabaseStatus RECOVERY_PENDING = fromString("RecoveryPending"); + + /** Static value Recovering for DatabaseStatus. */ + public static final DatabaseStatus RECOVERING = fromString("Recovering"); + + /** Static value Suspect for DatabaseStatus. */ + public static final DatabaseStatus SUSPECT = fromString("Suspect"); + + /** Static value Offline for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Standby for DatabaseStatus. */ + public static final DatabaseStatus STANDBY = fromString("Standby"); + + /** Static value Shutdown for DatabaseStatus. */ + public static final DatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value EmergencyMode for DatabaseStatus. */ + public static final DatabaseStatus EMERGENCY_MODE = fromString("EmergencyMode"); + + /** Static value AutoClosed for DatabaseStatus. */ + public static final DatabaseStatus AUTO_CLOSED = fromString("AutoClosed"); + + /** Static value Copying for DatabaseStatus. */ + public static final DatabaseStatus COPYING = fromString("Copying"); + + /** Static value Creating for DatabaseStatus. */ + public static final DatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for DatabaseStatus. */ + public static final DatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value OfflineSecondary for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_SECONDARY = fromString("OfflineSecondary"); + + /** Static value Pausing for DatabaseStatus. */ + public static final DatabaseStatus PAUSING = fromString("Pausing"); + + /** Static value Paused for DatabaseStatus. */ + public static final DatabaseStatus PAUSED = fromString("Paused"); + + /** Static value Resuming for DatabaseStatus. */ + public static final DatabaseStatus RESUMING = fromString("Resuming"); + + /** Static value Scaling for DatabaseStatus. */ + public static final DatabaseStatus SCALING = fromString("Scaling"); + + /** + * Creates or finds a DatabaseStatus from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseStatus + */ + @JsonCreator + public static DatabaseStatus fromString(String name) { + return fromString(name, DatabaseStatus.class); + } + + /** + * @return known DatabaseStatus values + */ + public static Collection values() { + return values(DatabaseStatus.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java new file mode 100644 index 0000000000000..eafe8ef45060a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java @@ -0,0 +1,712 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseUpdate { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * 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; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this database. Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /** + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @param createMode the createMode value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the max log size for this database. + * + * @return the maxLogSizeBytes value + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the name and tier of the SKU. + * + * @return the currentSku value + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java new file mode 100644 index 0000000000000..b363f4918cf43 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java @@ -0,0 +1,100 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessment extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. + */ + @JsonProperty(value = "properties.storageContainerSasKey", required = true) + private String storageContainerSasKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessment object itself. + */ + public DatabaseVulnerabilityAssessment withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessment object itself. + */ + public DatabaseVulnerabilityAssessment withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessment object itself. + */ + public DatabaseVulnerabilityAssessment withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..b57f178bb0dcb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.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.v2017_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import rx.Completable; + +/** + * Type representing DatabaseVulnerabilityAssessmentScans. + */ +public interface DatabaseVulnerabilityAssessmentScans { + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + + /** + * Lists the vulnerability assessment scans of 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. + * @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); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScansExport.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScansExport.java new file mode 100644 index 0000000000000..c0a9252568d1d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScansExport.java @@ -0,0 +1,40 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseVulnerabilityAssessmentScansExportInner; + +/** + * Type representing DatabaseVulnerabilityAssessmentScansExport. + */ +public interface DatabaseVulnerabilityAssessmentScansExport extends HasInner, HasManager { + /** + * @return the exportedReportLocation value. + */ + String exportedReportLocation(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Databases.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Databases.java new file mode 100644 index 0000000000000..a0ce679208269 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Databases.java @@ -0,0 +1,109 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Databases. + */ +public interface Databases extends SupportsCreating, HasInner { + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName); + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable pauseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable resumeAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id); + + /** + * Gets 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. + * @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 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 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 the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/EditionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/EditionCapability.java new file mode 100644 index 0000000000000..881e52b8594b1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/EditionCapability.java @@ -0,0 +1,105 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The edition capability. + */ +public class EditionCapability { + /** + * The database edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported service objectives for the edition. + */ + @JsonProperty(value = "supportedServiceLevelObjectives", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServiceLevelObjectives; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the database edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported service objectives for the edition. + * + * @return the supportedServiceLevelObjectives value + */ + public List supportedServiceLevelObjectives() { + return this.supportedServiceLevelObjectives; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the EditionCapability object itself. + */ + public EditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPool.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPool.java new file mode 100644 index 0000000000000..9af9d5d6f326e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPool.java @@ -0,0 +1,267 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolInner; +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.v2017_10_01_preview.implementation.SqlManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPool. + */ +public interface ElasticPool extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the licenseType value. + */ + ElasticPoolLicenseType licenseType(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the perDatabaseSettings value. + */ + ElasticPoolPerDatabaseSettings perDatabaseSettings(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the state value. + */ + ElasticPoolState state(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the ElasticPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ElasticPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ElasticPool definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the elasticpool definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the elasticpool definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the elasticpool definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(ElasticPoolLicenseType licenseType); + } + + /** + * The stage of the elasticpool definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the elasticpool definition allowing to specify PerDatabaseSettings. + */ + interface WithPerDatabaseSettings { + /** + * Specifies perDatabaseSettings. + */ + WithCreate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + + /** + * The stage of the elasticpool definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the elasticpool definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the elasticpool definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithLicenseType, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithPerDatabaseSettings, DefinitionStages.WithSku, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a ElasticPool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLicenseType, UpdateStages.WithMaxSizeBytes, UpdateStages.WithPerDatabaseSettings, UpdateStages.WithSku, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of ElasticPool update stages. + */ + interface UpdateStages { + /** + * The stage of the elasticpool update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(ElasticPoolLicenseType licenseType); + } + + /** + * The stage of the elasticpool update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the elasticpool update allowing to specify PerDatabaseSettings. + */ + interface WithPerDatabaseSettings { + /** + * Specifies perDatabaseSettings. + */ + Update withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + + /** + * The stage of the elasticpool update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the elasticpool update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the elasticpool update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolEditionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolEditionCapability.java new file mode 100644 index 0000000000000..1d8685d63c01f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolEditionCapability.java @@ -0,0 +1,105 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The elastic pool edition capability. + */ +public class ElasticPoolEditionCapability { + /** + * The elastic pool edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported elastic pool DTU levels for the edition. + */ + @JsonProperty(value = "supportedElasticPoolPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolPerformanceLevels; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the elastic pool edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported elastic pool DTU levels for the edition. + * + * @return the supportedElasticPoolPerformanceLevels value + */ + public List supportedElasticPoolPerformanceLevels() { + return this.supportedElasticPoolPerformanceLevels; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolEditionCapability object itself. + */ + public ElasticPoolEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolLicenseType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolLicenseType.java new file mode 100644 index 0000000000000..ad348e202dc34 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolLicenseType.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolLicenseType. + */ +public final class ElasticPoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ElasticPoolLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolLicenseType + */ + @JsonCreator + public static ElasticPoolLicenseType fromString(String name) { + return fromString(name, ElasticPoolLicenseType.class); + } + + /** + * @return known ElasticPoolLicenseType values + */ + public static Collection values() { + return values(ElasticPoolLicenseType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperation.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperation.java new file mode 100644 index 0000000000000..ed48fe185aa33 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperation.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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolOperationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPoolOperation. + */ +public interface ElasticPoolOperation extends HasInner, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @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 name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperations.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperations.java new file mode 100644 index 0000000000000..4267ff58d6b8c --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperations.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.v2017_10_01_preview; + +import rx.Observable; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolOperations. + */ +public interface ElasticPoolOperations extends HasInner { + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId); + + /** + * Gets a list of operations performed on the 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 String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java new file mode 100644 index 0000000000000..ddbd0dec6cf36 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The max per-database performance level capability. + */ +public class ElasticPoolPerDatabaseMaxPerformanceLevelCapability { + /** + * The maximum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * The list of supported min database performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMinPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMinPerformanceLevels; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the maximum performance level per database. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the list of supported min database performance levels. + * + * @return the supportedPerDatabaseMinPerformanceLevels value + */ + public List supportedPerDatabaseMinPerformanceLevels() { + return this.supportedPerDatabaseMinPerformanceLevels; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerDatabaseMaxPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMaxPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java new file mode 100644 index 0000000000000..03cfba5af15fe --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The minimum per-database performance level capability. + */ +public class ElasticPoolPerDatabaseMinPerformanceLevelCapability { + /** + * The minimum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the minimum performance level per database. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerDatabaseMinPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMinPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseSettings.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseSettings.java new file mode 100644 index 0000000000000..07ee0453597b4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseSettings.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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Per database settings of an elastic pool. + */ +public class ElasticPoolPerDatabaseSettings { + /** + * The minimum capacity all databases are guaranteed. + */ + @JsonProperty(value = "minCapacity") + private Double minCapacity; + + /** + * The maximum capacity any one database can consume. + */ + @JsonProperty(value = "maxCapacity") + private Double maxCapacity; + + /** + * Get the minimum capacity all databases are guaranteed. + * + * @return the minCapacity value + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minimum capacity all databases are guaranteed. + * + * @param minCapacity the minCapacity value to set + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the maximum capacity any one database can consume. + * + * @return the maxCapacity value + */ + public Double maxCapacity() { + return this.maxCapacity; + } + + /** + * Set the maximum capacity any one database can consume. + * + * @param maxCapacity the maxCapacity value to set + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMaxCapacity(Double maxCapacity) { + this.maxCapacity = maxCapacity; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerformanceLevelCapability.java new file mode 100644 index 0000000000000..666b095d33df1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerformanceLevelCapability.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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Elastic Pool performance level capability. + */ +public class ElasticPoolPerformanceLevelCapability { + /** + * The performance level for the pool. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /** + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * The maximum number of databases supported. + */ + @JsonProperty(value = "maxDatabaseCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxDatabaseCount; + + /** + * The included (free) max size for this performance level. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * The list of supported max sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The list of supported per database max sizes. + */ + @JsonProperty(value = "supportedPerDatabaseMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxSizes; + + /** + * The list of supported per database max performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMaxPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxPerformanceLevels; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the performance level for the pool. + * + * @return the performanceLevel value + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the maximum number of databases supported. + * + * @return the maxDatabaseCount value + */ + public Integer maxDatabaseCount() { + return this.maxDatabaseCount; + } + + /** + * Get the included (free) max size for this performance level. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the list of supported max sizes. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the list of supported per database max sizes. + * + * @return the supportedPerDatabaseMaxSizes value + */ + public List supportedPerDatabaseMaxSizes() { + return this.supportedPerDatabaseMaxSizes; + } + + /** + * Get the list of supported per database max performance levels. + * + * @return the supportedPerDatabaseMaxPerformanceLevels value + */ + public List supportedPerDatabaseMaxPerformanceLevels() { + return this.supportedPerDatabaseMaxPerformanceLevels; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerformanceLevelCapability object itself. + */ + public ElasticPoolPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolState.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolState.java new file mode 100644 index 0000000000000..5327f4c715ede --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolState.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolState. + */ +public final class ElasticPoolState extends ExpandableStringEnum { + /** Static value Creating for ElasticPoolState. */ + public static final ElasticPoolState CREATING = fromString("Creating"); + + /** Static value Ready for ElasticPoolState. */ + public static final ElasticPoolState READY = fromString("Ready"); + + /** Static value Disabled for ElasticPoolState. */ + public static final ElasticPoolState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ElasticPoolState from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolState + */ + @JsonCreator + public static ElasticPoolState fromString(String name) { + return fromString(name, ElasticPoolState.class); + } + + /** + * @return known ElasticPoolState values + */ + public static Collection values() { + return values(ElasticPoolState.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolUpdate.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolUpdate.java new file mode 100644 index 0000000000000..b346e59de9842 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolUpdate.java @@ -0,0 +1,179 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An elastic pool update. + */ +@JsonFlatten +public class ElasticPoolUpdate { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /** + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this elastic pool. Possible values + * include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the per database settings for the elastic pool. + * + * @return the perDatabaseSettings value + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + 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 ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPools.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPools.java new file mode 100644 index 0000000000000..3e480555fef2a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPools.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.v2017_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPools. + */ +public interface ElasticPools extends SupportsCreating, HasInner { + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets all elastic pools in 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroup.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroup.java new file mode 100644 index 0000000000000..8b022a6bf994a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroup.java @@ -0,0 +1,166 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.InstanceFailoverGroupInner; +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.v2017_10_01_preview.implementation.SqlManager; +import java.util.List; + +/** + * Type representing InstanceFailoverGroup. + */ +public interface InstanceFailoverGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the managedInstancePairs value. + */ + List managedInstancePairs(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerRegions value. + */ + List partnerRegions(); + + /** + * @return the readOnlyEndpoint value. + */ + InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * @return the readWriteEndpoint value. + */ + InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * @return the replicationRole value. + */ + InstanceFailoverGroupReplicationRole replicationRole(); + + /** + * @return the replicationState value. + */ + String replicationState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the InstanceFailoverGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithManagedInstancePairs, DefinitionStages.WithPartnerRegions, DefinitionStages.WithReadWriteEndpoint, DefinitionStages.WithCreate { + } + + /** + * Grouping of InstanceFailoverGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a InstanceFailoverGroup definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the instancefailovergroup definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies resourceGroupName, locationName. + */ + WithManagedInstancePairs withExistingLocation(String resourceGroupName, String locationName); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ManagedInstancePairs. + */ + interface WithManagedInstancePairs { + /** + * Specifies managedInstancePairs. + */ + WithPartnerRegions withManagedInstancePairs(List managedInstancePairs); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify PartnerRegions. + */ + interface WithPartnerRegions { + /** + * Specifies partnerRegions. + */ + WithReadWriteEndpoint withPartnerRegions(List partnerRegions); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ReadWriteEndpoint. + */ + interface WithReadWriteEndpoint { + /** + * Specifies readWriteEndpoint. + */ + WithCreate withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + WithCreate withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + /** + * 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.WithReadOnlyEndpoint { + } + } + /** + * The template for a InstanceFailoverGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithReadOnlyEndpoint { + } + + /** + * Grouping of InstanceFailoverGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the instancefailovergroup update allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + Update withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadOnlyEndpoint.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..a282ffa43559e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadOnlyEndpoint.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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-only endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadOnlyEndpoint { + /** + * Failover policy of the read-only endpoint for the failover group. + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @return the failoverPolicy value + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadOnlyEndpoint object itself. + */ + public InstanceFailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadWriteEndpoint.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..2057da2639a26 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadWriteEndpoint.java @@ -0,0 +1,73 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-write endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadWriteEndpoint { + /** + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /** + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @return the failoverPolicy value + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverWithDataLossGracePeriodMinutes value + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes(Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReplicationRole.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..1adfcac2f295e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReplicationRole.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InstanceFailoverGroupReplicationRole. + */ +public final class InstanceFailoverGroupReplicationRole extends ExpandableStringEnum { + /** Static value Primary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a InstanceFailoverGroupReplicationRole from its string representation. + * @param name a name to look for + * @return the corresponding InstanceFailoverGroupReplicationRole + */ + @JsonCreator + public static InstanceFailoverGroupReplicationRole fromString(String name) { + return fromString(name, InstanceFailoverGroupReplicationRole.class); + } + + /** + * @return known InstanceFailoverGroupReplicationRole values + */ + public static Collection values() { + return values(InstanceFailoverGroupReplicationRole.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroups.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroups.java new file mode 100644 index 0000000000000..5ab4216cafba7 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroups.java @@ -0,0 +1,75 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.InstanceFailoverGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InstanceFailoverGroups. + */ +public interface InstanceFailoverGroups extends SupportsCreating, HasInner { + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String resourceGroupName, final String locationName); + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LicenseTypeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LicenseTypeCapability.java new file mode 100644 index 0000000000000..d267909346880 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LicenseTypeCapability.java @@ -0,0 +1,74 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The license type capability. + */ +public class LicenseTypeCapability { + /** + * License type identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get license type identifier. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the LicenseTypeCapability object itself. + */ + public LicenseTypeCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LocationCapabilities.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LocationCapabilities.java new file mode 100644 index 0000000000000..3a7332650414c --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LocationCapabilities.java @@ -0,0 +1,46 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.LocationCapabilitiesInner; +import java.util.List; + +/** + * Type representing LocationCapabilities. + */ +public interface LocationCapabilities extends HasInner, HasManager { + /** + * @return the name value. + */ + String name(); + + /** + * @return the reason value. + */ + String reason(); + + /** + * @return the status value. + */ + CapabilityStatus status(); + + /** + * @return the supportedManagedInstanceVersions value. + */ + List supportedManagedInstanceVersions(); + + /** + * @return the supportedServerVersions value. + */ + List supportedServerVersions(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeCapability.java new file mode 100644 index 0000000000000..b00fea2d0e2cf --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeCapability.java @@ -0,0 +1,48 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The log size capability. + */ +public class LogSizeCapability { + /** + * The log size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * The units that the limit is expressed in. Possible values include: + * 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeUnit unit; + + /** + * Get the log size limit (see 'unit' for the units). + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent'. + * + * @return the unit value + */ + public LogSizeUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeUnit.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeUnit.java new file mode 100644 index 0000000000000..fd7aa55b13cb1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeUnit.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LogSizeUnit. + */ +public final class LogSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for LogSizeUnit. */ + public static final LogSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for LogSizeUnit. */ + public static final LogSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for LogSizeUnit. */ + public static final LogSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for LogSizeUnit. */ + public static final LogSizeUnit PETABYTES = fromString("Petabytes"); + + /** Static value Percent for LogSizeUnit. */ + public static final LogSizeUnit PERCENT = fromString("Percent"); + + /** + * Creates or finds a LogSizeUnit from its string representation. + * @param name a name to look for + * @return the corresponding LogSizeUnit + */ + @JsonCreator + public static LogSizeUnit fromString(String name) { + return fromString(name, LogSizeUnit.class); + } + + /** + * @return known LogSizeUnit values + */ + public static Collection values() { + return values(LogSizeUnit.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEditionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEditionCapability.java new file mode 100644 index 0000000000000..b7c2a579e9232 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEditionCapability.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed server capability. + */ +public class ManagedInstanceEditionCapability { + /** + * The managed server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The supported families. + */ + @JsonProperty(value = "supportedFamilies", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFamilies; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the managed server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the supported families. + * + * @return the supportedFamilies value + */ + public List supportedFamilies() { + return this.supportedFamilies; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceEditionCapability object itself. + */ + public ManagedInstanceEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceFamilyCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceFamilyCapability.java new file mode 100644 index 0000000000000..175468440c1c1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceFamilyCapability.java @@ -0,0 +1,150 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed server family capability. + */ +public class ManagedInstanceFamilyCapability { + /** + * Family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * SKU name. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * List of supported virtual cores values. + */ + @JsonProperty(value = "supportedVcoresValues", access = JsonProperty.Access.WRITE_ONLY) + private List supportedVcoresValues; + + /** + * Included size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * Storage size ranges. + */ + @JsonProperty(value = "supportedStorageSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageSizes; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get family name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get sKU name. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get list of supported virtual cores values. + * + * @return the supportedVcoresValues value + */ + public List supportedVcoresValues() { + return this.supportedVcoresValues; + } + + /** + * Get included size. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get storage size ranges. + * + * @return the supportedStorageSizes value + */ + public List supportedStorageSizes() { + return this.supportedStorageSizes; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceFamilyCapability object itself. + */ + public ManagedInstanceFamilyCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstancePairInfo.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstancePairInfo.java new file mode 100644 index 0000000000000..bd1a793b93f05 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstancePairInfo.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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Pairs of Managed Instances in the failover group. + */ +public class ManagedInstancePairInfo { + /** + * Id of Primary Managed Instance in pair. + */ + @JsonProperty(value = "primaryManagedInstanceId") + private String primaryManagedInstanceId; + + /** + * Id of Partner Managed Instance in pair. + */ + @JsonProperty(value = "partnerManagedInstanceId") + private String partnerManagedInstanceId; + + /** + * Get id of Primary Managed Instance in pair. + * + * @return the primaryManagedInstanceId value + */ + public String primaryManagedInstanceId() { + return this.primaryManagedInstanceId; + } + + /** + * Set id of Primary Managed Instance in pair. + * + * @param primaryManagedInstanceId the primaryManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPrimaryManagedInstanceId(String primaryManagedInstanceId) { + this.primaryManagedInstanceId = primaryManagedInstanceId; + return this; + } + + /** + * Get id of Partner Managed Instance in pair. + * + * @return the partnerManagedInstanceId value + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set id of Partner Managed Instance in pair. + * + * @param partnerManagedInstanceId the partnerManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPartnerManagedInstanceId(String partnerManagedInstanceId) { + this.partnerManagedInstanceId = partnerManagedInstanceId; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceTdeCertificates.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceTdeCertificates.java new file mode 100644 index 0000000000000..d40f1452ec066 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceTdeCertificates.java @@ -0,0 +1,31 @@ +/** + * 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.v2017_10_01_preview; + +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.TdeCertificateInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceTdeCertificatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceTdeCertificates. + */ +public interface ManagedInstanceTdeCertificates extends HasInner { + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVcoresCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVcoresCapability.java new file mode 100644 index 0000000000000..fc92266a82e99 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVcoresCapability.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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed instance virtual cores capability. + */ +public class ManagedInstanceVcoresCapability { + /** + * The virtual cores identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The virtual cores value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Integer value; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the virtual cores identifier. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the virtual cores value. + * + * @return the value value + */ + public Integer value() { + return this.value; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceVcoresCapability object itself. + */ + public ManagedInstanceVcoresCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVersionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVersionCapability.java new file mode 100644 index 0000000000000..b94bc3939f560 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVersionCapability.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed instance capability. + */ +public class ManagedInstanceVersionCapability { + /** + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported managed instance editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported managed instance editions. + * + * @return the supportedEditions value + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceVersionCapability object itself. + */ + public ManagedInstanceVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagementOperationState.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagementOperationState.java new file mode 100644 index 0000000000000..6252e858363a8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_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.v2017_10_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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeCapability.java new file mode 100644 index 0000000000000..a064d07edf58e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeCapability.java @@ -0,0 +1,48 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The maximum size capability. + */ +public class MaxSizeCapability { + /** + * The maximum size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * The units that the limit is expressed in. Possible values include: + * 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeUnit unit; + + /** + * Get the maximum size limit (see 'unit' for the units). + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + * + * @return the unit value + */ + public MaxSizeUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeRangeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeRangeCapability.java new file mode 100644 index 0000000000000..f89dedfbdc90e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeRangeCapability.java @@ -0,0 +1,120 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The maximum size range capability. + */ +public class MaxSizeRangeCapability { + /** + * Minimum value. + */ + @JsonProperty(value = "minValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability minValue; + + /** + * Maximum value. + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability maxValue; + + /** + * Scale/step size for discrete values between the minimum value and the + * maximum value. + */ + @JsonProperty(value = "scaleSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability scaleSize; + + /** + * Size of transaction log. + */ + @JsonProperty(value = "logSize", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeCapability logSize; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get minimum value. + * + * @return the minValue value + */ + public MaxSizeCapability minValue() { + return this.minValue; + } + + /** + * Get maximum value. + * + * @return the maxValue value + */ + public MaxSizeCapability maxValue() { + return this.maxValue; + } + + /** + * Get scale/step size for discrete values between the minimum value and the maximum value. + * + * @return the scaleSize value + */ + public MaxSizeCapability scaleSize() { + return this.scaleSize; + } + + /** + * Get size of transaction log. + * + * @return the logSize value + */ + public LogSizeCapability logSize() { + return this.logSize; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the MaxSizeRangeCapability object itself. + */ + public MaxSizeRangeCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeUnit.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeUnit.java new file mode 100644 index 0000000000000..f9d7c29d3dc4e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeUnit.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MaxSizeUnit. + */ +public final class MaxSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for MaxSizeUnit. */ + public static final MaxSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for MaxSizeUnit. */ + public static final MaxSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for MaxSizeUnit. */ + public static final MaxSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for MaxSizeUnit. */ + public static final MaxSizeUnit PETABYTES = fromString("Petabytes"); + + /** + * Creates or finds a MaxSizeUnit from its string representation. + * @param name a name to look for + * @return the corresponding MaxSizeUnit + */ + @JsonCreator + public static MaxSizeUnit fromString(String name) { + return fromString(name, MaxSizeUnit.class); + } + + /** + * @return known MaxSizeUnit values + */ + public static Collection values() { + return values(MaxSizeUnit.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PartnerRegionInfo.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PartnerRegionInfo.java new file mode 100644 index 0000000000000..757aedc556ac6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PartnerRegionInfo.java @@ -0,0 +1,59 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Partner region information for the failover group. + */ +public class PartnerRegionInfo { + /** + * Geo location of the partner managed instances. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Replication role of the partner managed instances. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Get geo location of the partner managed instances. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set geo location of the partner managed instances. + * + * @param location the location value to set + * @return the PartnerRegionInfo object itself. + */ + public PartnerRegionInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get replication role of the partner managed instances. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelCapability.java new file mode 100644 index 0000000000000..c88d7bc274707 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelCapability.java @@ -0,0 +1,48 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The performance level capability. + */ +public class PerformanceLevelCapability { + /** + * Performance level value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * Get performance level value. + * + * @return the value value + */ + public Double value() { + return this.value; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelUnit.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelUnit.java new file mode 100644 index 0000000000000..77876378f4b7d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelUnit.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PerformanceLevelUnit. + */ +public final class PerformanceLevelUnit extends ExpandableStringEnum { + /** Static value DTU for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit DTU = fromString("DTU"); + + /** Static value VCores for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit VCORES = fromString("VCores"); + + /** + * Creates or finds a PerformanceLevelUnit from its string representation. + * @param name a name to look for + * @return the corresponding PerformanceLevelUnit + */ + @JsonCreator + public static PerformanceLevelUnit fromString(String name) { + return fromString(name, PerformanceLevelUnit.class); + } + + /** + * @return known PerformanceLevelUnit values + */ + public static Collection values() { + return values(PerformanceLevelUnit.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadOnlyEndpointFailoverPolicy.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadOnlyEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..ffa4594e99fbb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadOnlyEndpointFailoverPolicy.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadOnlyEndpointFailoverPolicy. + */ +public final class ReadOnlyEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Disabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy DISABLED = fromString("Disabled"); + + /** Static value Enabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy ENABLED = fromString("Enabled"); + + /** + * Creates or finds a ReadOnlyEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadOnlyEndpointFailoverPolicy + */ + @JsonCreator + public static ReadOnlyEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadOnlyEndpointFailoverPolicy.class); + } + + /** + * @return known ReadOnlyEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadOnlyEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadWriteEndpointFailoverPolicy.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadWriteEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..6997fa0ffa8af --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadWriteEndpointFailoverPolicy.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadWriteEndpointFailoverPolicy. + */ +public final class ReadWriteEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Manual for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy MANUAL = fromString("Manual"); + + /** Static value Automatic for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a ReadWriteEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadWriteEndpointFailoverPolicy + */ + @JsonCreator + public static ReadWriteEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadWriteEndpointFailoverPolicy.class); + } + + /** + * @return known ReadWriteEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadWriteEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ResourceMoveDefinition.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ResourceMoveDefinition.java new file mode 100644 index 0000000000000..cd9239a5f310d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ResourceMoveDefinition.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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a resource move (rename). + */ +public class ResourceMoveDefinition { + /** + * The target ID for the resource. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the target ID for the resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the target ID for the resource. + * + * @param id the id value to set + * @return the ResourceMoveDefinition object itself. + */ + public ResourceMoveDefinition withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/SampleName.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/SampleName.java new file mode 100644 index 0000000000000..a83caaba4d382 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/SampleName.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SampleName. + */ +public final class SampleName extends ExpandableStringEnum { + /** Static value AdventureWorksLT for SampleName. */ + public static final SampleName ADVENTURE_WORKS_LT = fromString("AdventureWorksLT"); + + /** Static value WideWorldImportersStd for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_STD = fromString("WideWorldImportersStd"); + + /** Static value WideWorldImportersFull for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_FULL = fromString("WideWorldImportersFull"); + + /** + * Creates or finds a SampleName from its string representation. + * @param name a name to look for + * @return the corresponding SampleName + */ + @JsonCreator + public static SampleName fromString(String name) { + return fromString(name, SampleName.class); + } + + /** + * @return known SampleName values + */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVersionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVersionCapability.java new file mode 100644 index 0000000000000..e3989fe0e1b12 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVersionCapability.java @@ -0,0 +1,105 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The server capability. + */ +public class ServerVersionCapability { + /** + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported database editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /** + * The list of supported elastic pool editions. + */ + @JsonProperty(value = "supportedElasticPoolEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolEditions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported database editions. + * + * @return the supportedEditions value + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the list of supported elastic pool editions. + * + * @return the supportedElasticPoolEditions value + */ + public List supportedElasticPoolEditions() { + return this.supportedElasticPoolEditions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ServerVersionCapability object itself. + */ + public ServerVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServiceObjectiveCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServiceObjectiveCapability.java new file mode 100644 index 0000000000000..69d8807c326ff --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServiceObjectiveCapability.java @@ -0,0 +1,166 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.UUID; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The service objectives capability. + */ +public class ServiceObjectiveCapability { + /** + * The unique ID of the service objective. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private UUID id; + + /** + * The service objective name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported maximum database sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The performance level. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /** + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * The included (free) max size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the unique ID of the service objective. + * + * @return the id value + */ + public UUID id() { + return this.id; + } + + /** + * Get the service objective name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported maximum database sizes. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the performance level. + * + * @return the performanceLevel value + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the included (free) max size. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ServiceObjectiveCapability object itself. + */ + public ServiceObjectiveCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Sku.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Sku.java new file mode 100644 index 0000000000000..1e666f1e4dafc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Sku.java @@ -0,0 +1,152 @@ +/** + * 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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the 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 if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/TdeCertificates.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/TdeCertificates.java new file mode 100644 index 0000000000000..ff1eaa617f9a8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/TdeCertificates.java @@ -0,0 +1,31 @@ +/** + * 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.v2017_10_01_preview; + +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.TdeCertificateInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.TdeCertificatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TdeCertificates. + */ +public interface TdeCertificates extends HasInner { + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentRecurringScansProperties.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..71096e2cb5757 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,98 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get recurring scans state. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set recurring scans state. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanError.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanError.java new file mode 100644 index 0000000000000..7f58d77b33e59 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanError.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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a vulnerability assessment scan error. + */ +public class VulnerabilityAssessmentScanError { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..f575129cb8f49 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.VulnerabilityAssessmentScanRecordInner; +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.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing VulnerabilityAssessmentScanRecord. + */ +public interface VulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanState.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanState.java new file mode 100644 index 0000000000000..fd896958ca6bb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanState.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanState. + */ +public final class VulnerabilityAssessmentScanState extends ExpandableStringEnum { + /** Static value Passed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState PASSED = fromString("Passed"); + + /** Static value Failed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED = fromString("Failed"); + + /** Static value FailedToRun for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED_TO_RUN = fromString("FailedToRun"); + + /** Static value InProgress for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState IN_PROGRESS = fromString("InProgress"); + + /** + * Creates or finds a VulnerabilityAssessmentScanState from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanState + */ + @JsonCreator + public static VulnerabilityAssessmentScanState fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanState.class); + } + + /** + * @return known VulnerabilityAssessmentScanState values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanState.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanTriggerType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanTriggerType.java new file mode 100644 index 0000000000000..722b5668a37f8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanTriggerType.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanTriggerType. + */ +public final class VulnerabilityAssessmentScanTriggerType extends ExpandableStringEnum { + /** Static value OnDemand for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType ON_DEMAND = fromString("OnDemand"); + + /** Static value Recurring for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType RECURRING = fromString("Recurring"); + + /** + * Creates or finds a VulnerabilityAssessmentScanTriggerType from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanTriggerType + */ + @JsonCreator + public static VulnerabilityAssessmentScanTriggerType fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanTriggerType.class); + } + + /** + * @return known VulnerabilityAssessmentScanTriggerType values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanTriggerType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..8fde97f0db81a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicy; + +class BackupShortTermRetentionPoliciesImpl extends WrapperImpl implements BackupShortTermRetentionPolicies { + private final SqlManager manager; + + BackupShortTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().backupShortTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public BackupShortTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private BackupShortTermRetentionPolicyImpl wrapModel(BackupShortTermRetentionPolicyInner inner) { + return new BackupShortTermRetentionPolicyImpl(inner, manager()); + } + + private BackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new BackupShortTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + BackupShortTermRetentionPoliciesInner 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 BackupShortTermRetentionPolicy call(BackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + BackupShortTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupShortTermRetentionPolicy call(BackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..f0498bb847759 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java @@ -0,0 +1,1135 @@ +/** + * 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.v2017_10_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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 BackupShortTermRetentionPolicies. + */ +public class BackupShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private BackupShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackupShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(BackupShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BackupShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface BackupShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v2017_10_01_preview.BackupShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies") + 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.v2017_10_01_preview.BackupShortTermRetentionPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner 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 policyName = "default"; + return service.get(resourceGroupName, serverName, 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); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, 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 = 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); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 updateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, serverName, databaseName, policyName, 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 a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, serverName, databaseName, policyName, 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 database's short 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 serverName The name of the server. + * @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<BackupShortTermRetentionPolicyInner> 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 database's short 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 serverName The name of the server. + * @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 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 database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackupShortTermRetentionPolicyInner> 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 database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackupShortTermRetentionPolicyInner> 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 database's short 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BackupShortTermRetentionPolicyInner> 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 database's short 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<BackupShortTermRetentionPolicyInner> 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 short 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 short 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<BackupShortTermRetentionPolicyInner> 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 short 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<BackupShortTermRetentionPolicyInner> 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 short 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<BackupShortTermRetentionPolicyInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..386dd7a3b554e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class BackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements BackupShortTermRetentionPolicy, BackupShortTermRetentionPolicy.Definition, BackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + BackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new BackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + BackupShortTermRetentionPolicyImpl(BackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @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 Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BackupShortTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..f1dde126ce62f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyInner.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.v2017_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A short term retention policy. + */ +@JsonFlatten +public class BackupShortTermRetentionPolicyInner extends ProxyResource { + /** + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @param retentionDays the retentionDays value to set + * @return the BackupShortTermRetentionPolicyInner object itself. + */ + public BackupShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..18d7395ad1aff --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.LocationCapabilities; + +class CapabilitiesImpl extends WrapperImpl implements Capabilities { + private final SqlManager manager; + + CapabilitiesImpl(SqlManager manager) { + super(manager.inner().capabilities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByLocationAsync(String locationName) { + CapabilitiesInner client = this.inner(); + return client.listByLocationAsync(locationName) + .map(new Func1() { + @Override + public LocationCapabilities call(LocationCapabilitiesInner inner) { + return new LocationCapabilitiesImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java new file mode 100644 index 0000000000000..267b5e8d1fc03 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java @@ -0,0 +1,217 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CapabilityGroup; +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 Capabilities. + */ +public class CapabilitiesInner { + /** The Retrofit service to perform REST calls. */ + private CapabilitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of CapabilitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CapabilitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(CapabilitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Capabilities to be + * used by Retrofit to perform actually REST calls. + */ + interface CapabilitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities") + Observable> listByLocation(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("include") CapabilityGroup include, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are 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 LocationCapabilitiesInner object if successful. + */ + public LocationCapabilitiesInner listByLocation(String locationName) { + return listByLocationWithServiceResponseAsync(locationName).toBlocking().single().body(); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are 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 listByLocationAsync(String locationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(locationName), serviceCallback); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable listByLocationAsync(String locationName) { + return listByLocationWithServiceResponseAsync(locationName).map(new Func1, LocationCapabilitiesInner>() { + @Override + public LocationCapabilitiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable> listByLocationWithServiceResponseAsync(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 CapabilityGroup include = null; + return service.listByLocation(locationName, this.client.subscriptionId(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @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 LocationCapabilitiesInner object if successful. + */ + public LocationCapabilitiesInner listByLocation(String locationName, CapabilityGroup include) { + return listByLocationWithServiceResponseAsync(locationName, include).toBlocking().single().body(); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @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(String locationName, CapabilityGroup include, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(locationName, include), serviceCallback); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable listByLocationAsync(String locationName, CapabilityGroup include) { + return listByLocationWithServiceResponseAsync(locationName, include).map(new Func1, LocationCapabilitiesInner>() { + @Override + public LocationCapabilitiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable> listByLocationWithServiceResponseAsync(String locationName, CapabilityGroup include) { + 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(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByLocationDelegate(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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..90eac77d4eb12 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseImpl.java @@ -0,0 +1,467 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.Database; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseUpdate; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CreateMode; +import com.microsoft.azure.management.sql.v2017_10_01_preview.SampleName; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseStatus; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseLicenseType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseReadScale; +import rx.functions.Func1; + +class DatabaseImpl extends CreatableUpdatableImpl implements Database, Database.Definition, Database.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private DatabaseUpdate updateParameter; + + DatabaseImpl(String name, SqlManager manager) { + super(name, new DatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new DatabaseUpdate(); + } + + DatabaseImpl(DatabaseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public CatalogCollationType catalogCollation() { + return this.inner().catalogCollation(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public CreateMode createMode() { + return this.inner().createMode(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String currentServiceObjectiveName() { + return this.inner().currentServiceObjectiveName(); + } + + @Override + public Sku currentSku() { + return this.inner().currentSku(); + } + + @Override + public UUID databaseId() { + return this.inner().databaseId(); + } + + @Override + public String defaultSecondaryLocation() { + return this.inner().defaultSecondaryLocation(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String elasticPoolId() { + return this.inner().elasticPoolId(); + } + + @Override + public String failoverGroupId() { + return this.inner().failoverGroupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DatabaseLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String longTermRetentionBackupResourceId() { + return this.inner().longTermRetentionBackupResourceId(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public Long maxLogSizeBytes() { + return this.inner().maxLogSizeBytes(); + } + + @Override + public Long maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DatabaseReadScale readScale() { + return this.inner().readScale(); + } + + @Override + public String recoverableDatabaseId() { + return this.inner().recoverableDatabaseId(); + } + + @Override + public String recoveryServicesRecoveryPointId() { + return this.inner().recoveryServicesRecoveryPointId(); + } + + @Override + public String requestedServiceObjectiveName() { + return this.inner().requestedServiceObjectiveName(); + } + + @Override + public String restorableDroppedDatabaseId() { + return this.inner().restorableDroppedDatabaseId(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public SampleName sampleName() { + return this.inner().sampleName(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public DateTime sourceDatabaseDeletionDate() { + return this.inner().sourceDatabaseDeletionDate(); + } + + @Override + public String sourceDatabaseId() { + return this.inner().sourceDatabaseId(); + } + + @Override + public DatabaseStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public DatabaseImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + if (isInCreateMode()) { + this.inner().withCatalogCollation(catalogCollation); + } else { + this.updateParameter.withCatalogCollation(catalogCollation); + } + return this; + } + + @Override + public DatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public DatabaseImpl withCreateMode(CreateMode createMode) { + if (isInCreateMode()) { + this.inner().withCreateMode(createMode); + } else { + this.updateParameter.withCreateMode(createMode); + } + return this; + } + + @Override + public DatabaseImpl withElasticPoolId(String elasticPoolId) { + if (isInCreateMode()) { + this.inner().withElasticPoolId(elasticPoolId); + } else { + this.updateParameter.withElasticPoolId(elasticPoolId); + } + return this; + } + + @Override + public DatabaseImpl withLicenseType(DatabaseLicenseType licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public DatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (isInCreateMode()) { + this.inner().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } else { + this.updateParameter.withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } + return this; + } + + @Override + public DatabaseImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public DatabaseImpl withReadScale(DatabaseReadScale readScale) { + if (isInCreateMode()) { + this.inner().withReadScale(readScale); + } else { + this.updateParameter.withReadScale(readScale); + } + return this; + } + + @Override + public DatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.inner().withRecoverableDatabaseId(recoverableDatabaseId); + } else { + this.updateParameter.withRecoverableDatabaseId(recoverableDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + if (isInCreateMode()) { + this.inner().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } else { + this.updateParameter.withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } + return this; + } + + @Override + public DatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.inner().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } else { + this.updateParameter.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public DatabaseImpl withSampleName(SampleName sampleName) { + if (isInCreateMode()) { + this.inner().withSampleName(sampleName); + } else { + this.updateParameter.withSampleName(sampleName); + } + return this; + } + + @Override + public DatabaseImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } else { + this.updateParameter.withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + } else { + this.updateParameter.withSourceDatabaseId(sourceDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java new file mode 100644 index 0000000000000..9c0e11f49b7f6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java @@ -0,0 +1,723 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CreateMode; +import com.microsoft.azure.management.sql.v2017_10_01_preview.SampleName; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseStatus; +import java.util.UUID; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseLicenseType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseReadScale; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Kind of database. This is metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource that manages the database. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * 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; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this database. Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /** + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource that manages the database. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @param createMode the createMode value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + 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 DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the max log size for this database. + * + * @return the maxLogSizeBytes value + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the name and tier of the SKU. + * + * @return the currentSku value + */ + public Sku currentSku() { + return this.currentSku; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationImpl.java new file mode 100644 index 0000000000000..27954dfb294ce --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagementOperationState; + +class DatabaseOperationImpl extends WrapperImpl implements DatabaseOperation { + private final SqlManager manager; + + DatabaseOperationImpl(DatabaseOperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @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 name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationInner.java new file mode 100644 index 0000000000000..1560c1b9b2ac6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationInner.java @@ -0,0 +1,233 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database operation. + */ +@JsonFlatten +public class DatabaseOperationInner extends ProxyResource { + /** + * The name of the database the operation is being performed on. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * 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 name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * 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; + + /** + * Get the name of the database the operation is being performed on. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * 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 name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * 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; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsImpl.java new file mode 100644 index 0000000000000..c8be8c8a6fef6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperation; + +class DatabaseOperationsImpl extends WrapperImpl implements DatabaseOperations { + private final SqlManager manager; + + DatabaseOperationsImpl(SqlManager manager) { + super(manager.inner().databaseOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabaseOperationImpl wrapModel(DatabaseOperationInner inner) { + return new DatabaseOperationImpl(inner, manager()); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + DatabaseOperationsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, databaseName, operationId).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseOperationsInner 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 DatabaseOperation call(DatabaseOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsInner.java new file mode 100644 index 0000000000000..55ba5816ab202 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsInner.java @@ -0,0 +1,417 @@ +/** + * 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.v2017_10_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.POST; +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 DatabaseOperations. + */ +public class DatabaseOperationsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2017_10_01_preview.DatabaseOperations listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations") + 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.v2017_10_01_preview.DatabaseOperations listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).toBlocking().single().body(); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @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 cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId), serviceCallback); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + 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 (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.cancel(resourceGroupName, serverName, databaseName, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 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. + * @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<DatabaseOperationInner> 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 operations performed on the 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. + * @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 operations performed on the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseOperationInner> 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 operations performed on the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseOperationInner> 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 operations performed on the 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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); + } + + /** + * Gets a list of operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java new file mode 100644 index 0000000000000..4a8a8a8aff3d1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java @@ -0,0 +1,46 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DatabaseVulnerabilityAssessmentScansExportImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentScansExport { + private final SqlManager manager; + DatabaseVulnerabilityAssessmentScansExportImpl(DatabaseVulnerabilityAssessmentScansExportInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String exportedReportLocation() { + return this.inner().exportedReportLocation(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java new file mode 100644 index 0000000000000..26a307dceb7e7 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java @@ -0,0 +1,36 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database Vulnerability Assessment scan export resource. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentScansExportInner extends ProxyResource { + /** + * Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + @JsonProperty(value = "properties.exportedReportLocation", access = JsonProperty.Access.WRITE_ONLY) + private String exportedReportLocation; + + /** + * Get location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + * + * @return the exportedReportLocation value + */ + public String exportedReportLocation() { + return this.exportedReportLocation; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..600bda466a785 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,94 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; + +class DatabaseVulnerabilityAssessmentScansImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentScans { + private final SqlManager manager; + + DatabaseVulnerabilityAssessmentScansImpl(SqlManager manager) { + super(manager.inner().databaseVulnerabilityAssessmentScans()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private VulnerabilityAssessmentScanRecordImpl wrapVulnerabilityAssessmentScanRecordModel(VulnerabilityAssessmentScanRecordInner inner) { + return new VulnerabilityAssessmentScanRecordImpl(inner, manager()); + } + + private Observable getVulnerabilityAssessmentScanRecordInnerUsingDatabaseVulnerabilityAssessmentScansInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String scanId = IdParsingUtils.getValueFromIdByName(id, "scans"); + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, scanId); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, scanId) + .map(new Func1() { + @Override + public VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapVulnerabilityAssessmentScanRecordModel(inner); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseVulnerabilityAssessmentScansInner 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 VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapVulnerabilityAssessmentScanRecordModel(inner); + } + }); + } + + @Override + public Completable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.initiateScanAsync(resourceGroupName, serverName, databaseName, scanId).toCompletable(); + } + + @Override + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.exportAsync(resourceGroupName, serverName, databaseName, scanId) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentScansExport call(DatabaseVulnerabilityAssessmentScansExportInner inner) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java new file mode 100644 index 0000000000000..e847f2a52385a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java @@ -0,0 +1,717 @@ +/** + * 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.v2017_10_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 okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 DatabaseVulnerabilityAssessmentScans. + */ +public class DatabaseVulnerabilityAssessmentScansInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentScansService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentScansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentScansService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessmentScans to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans initiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> initiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans beginInitiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> beginInitiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 VulnerabilityAssessmentScanRecordInner object if successful. + */ + public VulnerabilityAssessmentScanRecordInner get(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, VulnerabilityAssessmentScanRecordInner>() { + @Override + public VulnerabilityAssessmentScanRecordInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan(String resourceGroupName, String serverName, String databaseName, String scanId) { + initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().last().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> initiateScanWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + Observable> observable = service.initiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScan(String resourceGroupName, String serverName, String databaseName, String scanId) { + beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginInitiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginInitiateScanWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.beginInitiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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 = beginInitiateScanDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginInitiateScanDelegate(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 the vulnerability assessment scans of 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. + * @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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of 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. + * @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); + } + + /** + * Lists the vulnerability assessment scans of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 DatabaseVulnerabilityAssessmentScansExportInner object if successful. + */ + public DatabaseVulnerabilityAssessmentScansExportInner export(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, DatabaseVulnerabilityAssessmentScansExportInner>() { + @Override + public DatabaseVulnerabilityAssessmentScansExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.export(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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 = exportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDelegate(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); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..03664427619c3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesImpl.java @@ -0,0 +1,135 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Databases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Database; + +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 DatabaseImpl define(String name) { + return wrapModel(name); + } + + private DatabaseImpl wrapModel(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + + private DatabaseImpl wrapModel(String name) { + return new DatabaseImpl(name, this.manager()); + } + + @Override + public Completable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.pauseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.resumeAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + DatabasesInner client = this.inner(); + return client.renameAsync(resourceGroupName, serverName, databaseName, id).toCompletable(); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + DatabasesInner 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 Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..ae43311abb3de --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java @@ -0,0 +1,1862 @@ +/** + * 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.v2017_10_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.v2017_10_01_preview.DatabaseUpdate; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ResourceMoveDefinition; +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 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.v2017_10_01_preview.Databases upgradeDataWarehouse" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + Observable> upgradeDataWarehouse(@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.v2017_10_01_preview.Databases beginUpgradeDataWarehouse" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + Observable> beginUpgradeDataWarehouse(@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.v2017_10_01_preview.Databases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases") + 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.v2017_10_01_preview.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> get(@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.v2017_10_01_preview.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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.v2017_10_01_preview.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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.v2017_10_01_preview.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2017_10_01_preview.Databases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2017_10_01_preview.Databases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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.v2017_10_01_preview.Databases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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.v2017_10_01_preview.Databases listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases") + Observable> listByElasticPool(@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.v2017_10_01_preview.Databases pause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> pause(@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.v2017_10_01_preview.Databases beginPause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> beginPause(@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.v2017_10_01_preview.Databases resume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> resume(@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.v2017_10_01_preview.Databases beginResume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> beginResume(@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.v2017_10_01_preview.Databases rename" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move") + Observable> rename(@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, @Body ResourceMoveDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases listByServerNext" }) + @GET + Observable> listByServerNext(@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.v2017_10_01_preview.Databases listByElasticPoolNext" }) + @GET + Observable> listByElasticPoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> upgradeDataWarehouseWithServiceResponseAsync(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."); + } + Observable> observable = service.upgradeDataWarehouse(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 beginUpgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 beginUpgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUpgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUpgradeDataWarehouseWithServiceResponseAsync(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."); + } + return service.beginUpgradeDataWarehouse(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 clientResponse = beginUpgradeDataWarehouseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpgradeDataWarehouseDelegate(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 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 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<DatabaseInner> 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 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 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> 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 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. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets 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. + * @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. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner 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."); + } + return service.get(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 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner 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); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner 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); + return service.beginCreateOrUpdate(resourceGroupName, serverName, 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 the 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. + * @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 databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes the 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. + * @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 databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(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."); + } + Observable> observable = service.delete(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the 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. + * @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 databaseName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes the 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. + * @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 databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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."); + } + return service.beginDelete(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 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate 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); + Observable> observable = service.update(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate 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); + return service.beginUpdate(resourceGroupName, serverName, 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); + } + + /** + * Gets a list of databases in 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. + * @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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPool(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ServiceResponse> response = listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in 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. + * @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> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName) + .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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic 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 serverName The name of the server. + ServiceResponse> * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolSinglePageAsync(final String resourceGroupName, final String serverName, final 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.listByElasticPool(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> result = listByElasticPoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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); + } + + /** + * Pauses 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 be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Pauses 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 be paused. + * @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 pauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> pauseWithServiceResponseAsync(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."); + } + Observable> observable = service.pause(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Pauses 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 be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginPause(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Pauses 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 be paused. + * @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 beginPauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginPauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginPauseWithServiceResponseAsync(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."); + } + return service.beginPause(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 clientResponse = beginPauseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPauseDelegate(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); + } + + /** + * Resumes 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 be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Resumes 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 be resumed. + * @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 resumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resumeWithServiceResponseAsync(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."); + } + Observable> observable = service.resume(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Resumes 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 be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginResume(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Resumes 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 be resumed. + * @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 beginResumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginResumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginResumeWithServiceResponseAsync(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."); + } + return service.beginResume(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 clientResponse = beginResumeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResumeDelegate(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); + } + + /** + * Renames 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 rename. + * @param id The target ID for the 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 + */ + public void rename(String resourceGroupName, String serverName, String databaseName, String id) { + renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).toBlocking().single().body(); + } + + /** + * Renames 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 rename. + * @param id The target ID for the 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 renameAsync(String resourceGroupName, String serverName, String databaseName, String id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id), serviceCallback); + } + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> renameWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String id) { + 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."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + ResourceMoveDefinition parameters = new ResourceMoveDefinition(); + parameters.withId(id); + return service.rename(resourceGroupName, serverName, 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 = renameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse renameDelegate(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 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<DatabaseInner> 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 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> 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 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<DatabaseInner> 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 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<DatabaseInner> 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 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<DatabaseInner> 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); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPoolNext(final String nextPageLink) { + ServiceResponse> response = listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in an elastic 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> listByElasticPoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object + */ + public Observable> listByElasticPoolNextAsync(final String nextPageLink) { + return listByElasticPoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object + */ + public Observable>> listByElasticPoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolNextDelegate(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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolImpl.java new file mode 100644 index 0000000000000..88df7092bc8cc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolImpl.java @@ -0,0 +1,238 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPool; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolUpdate; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolPerDatabaseSettings; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolLicenseType; +import rx.functions.Func1; + +class ElasticPoolImpl extends CreatableUpdatableImpl implements ElasticPool, ElasticPool.Definition, ElasticPool.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String elasticPoolName; + private ElasticPoolUpdate updateParameter; + + ElasticPoolImpl(String name, SqlManager manager) { + super(name, new ElasticPoolInner()); + this.manager = manager; + // Set resource name + this.elasticPoolName = name; + // + this.updateParameter = new ElasticPoolUpdate(); + } + + ElasticPoolImpl(ElasticPoolInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.elasticPoolName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.elasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "elasticPools"); + // + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.inner()) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.updateParameter) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.elasticPoolName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public ElasticPoolLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Long maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.inner().perDatabaseSettings(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public ElasticPoolState state() { + return this.inner().state(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public ElasticPoolImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ElasticPoolImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ElasticPoolImpl withLicenseType(ElasticPoolLicenseType licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public ElasticPoolImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public ElasticPoolImpl withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + if (isInCreateMode()) { + this.inner().withPerDatabaseSettings(perDatabaseSettings); + } else { + this.updateParameter.withPerDatabaseSettings(perDatabaseSettings); + } + return this; + } + + @Override + public ElasticPoolImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public ElasticPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public ElasticPoolImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java new file mode 100644 index 0000000000000..e7e1135945e93 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolPerDatabaseSettings; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolLicenseType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An elastic pool. + */ +@JsonFlatten +public class ElasticPoolInner extends Resource { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Kind of elastic pool. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The state of the elastic pool. Possible values include: 'Creating', + * 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /** + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /** + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this elastic pool. Possible values + * include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled'. + * + * @return the state value + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the per database settings for the elastic pool. + * + * @return the perDatabaseSettings value + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationImpl.java new file mode 100644 index 0000000000000..3729dc983f02c --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationImpl.java @@ -0,0 +1,116 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ElasticPoolOperationImpl extends WrapperImpl implements ElasticPoolOperation { + private final SqlManager manager; + + ElasticPoolOperationImpl(ElasticPoolOperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @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 name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationInner.java new file mode 100644 index 0000000000000..7f8909f84caca --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationInner.java @@ -0,0 +1,231 @@ +/** + * 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.v2017_10_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 elastic pool operation. + */ +@JsonFlatten +public class ElasticPoolOperationInner extends ProxyResource { + /** + * The name of the elastic pool the operation is being performed on. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * 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 name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The operation state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String 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; + + /** + * Get the name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * 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 name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the operation start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the operation state. + * + * @return the state value + */ + public String 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; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsImpl.java new file mode 100644 index 0000000000000..6ec255b0558ae --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperation; + +class ElasticPoolOperationsImpl extends WrapperImpl implements ElasticPoolOperations { + private final SqlManager manager; + + ElasticPoolOperationsImpl(SqlManager manager) { + super(manager.inner().elasticPoolOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ElasticPoolOperationImpl wrapModel(ElasticPoolOperationInner inner) { + return new ElasticPoolOperationImpl(inner, manager()); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + ElasticPoolOperationsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, elasticPoolName, operationId).toCompletable(); + } + + @Override + public Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ElasticPoolOperationsInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ElasticPoolOperation call(ElasticPoolOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsInner.java new file mode 100644 index 0000000000000..0ef8ae480283b --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsInner.java @@ -0,0 +1,417 @@ +/** + * 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.v2017_10_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.POST; +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 ElasticPoolOperations. + */ +public class ElasticPoolOperationsInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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.v2017_10_01_preview.ElasticPoolOperations listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations") + Observable> listByElasticPool(@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.v2017_10_01_preview.ElasticPoolOperations listByElasticPoolNext" }) + @GET + Observable> listByElasticPoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId).toBlocking().single().body(); + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @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 cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId), serviceCallback); + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + 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 (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.cancel(resourceGroupName, serverName, elasticPoolName, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 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 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 + * @return the PagedList<ElasticPoolOperationInner> object if successful. + */ + public PagedList listByElasticPool(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ServiceResponse> response = listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the 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 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> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the 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 String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolOperationInner> object + */ + public Observable> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the 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 String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolOperationInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName) + .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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the elastic 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 serverName The name of the server. + ServiceResponse> * @param elasticPoolName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolSinglePageAsync(final String resourceGroupName, final String serverName, final 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.listByElasticPool(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> result = listByElasticPoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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 operations performed on the elastic 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<ElasticPoolOperationInner> object if successful. + */ + public PagedList listByElasticPoolNext(final String nextPageLink) { + ServiceResponse> response = listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the elastic 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> listByElasticPoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the elastic 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<ElasticPoolOperationInner> object + */ + public Observable> listByElasticPoolNextAsync(final String nextPageLink) { + return listByElasticPoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the elastic 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<ElasticPoolOperationInner> object + */ + public Observable>> listByElasticPoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the elastic 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<ElasticPoolOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolNextDelegate(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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..98ef70fe4456e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPools; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPool; + +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 ElasticPoolImpl define(String name) { + return wrapModel(name); + } + + private ElasticPoolImpl wrapModel(ElasticPoolInner inner) { + return new ElasticPoolImpl(inner, manager()); + } + + private ElasticPoolImpl wrapModel(String name) { + return new ElasticPoolImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ElasticPoolsInner 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 ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1() { + @Override + public ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, elasticPoolName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsInner.java new file mode 100644 index 0000000000000..5dde96c7023bb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsInner.java @@ -0,0 +1,1095 @@ +/** + * 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.v2017_10_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.v2017_10_01_preview.ElasticPoolUpdate; +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 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.v2017_10_01_preview.ElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools") + Observable> listByServer(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Query("$skip") Integer skip, @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.v2017_10_01_preview.ElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> get(@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.v2017_10_01_preview.ElasticPools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolInner 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.v2017_10_01_preview.ElasticPools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolInner 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.v2017_10_01_preview.ElasticPools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2017_10_01_preview.ElasticPools beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2017_10_01_preview.ElasticPools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate 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.v2017_10_01_preview.ElasticPools beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate 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.v2017_10_01_preview.ElasticPools listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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 PagedList<ElasticPoolInner> 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."); + } + final Integer skip = null; + return service.listByServer(resourceGroupName, serverName, this.client.subscriptionId(), skip, 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); + } + } + }); + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @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<ElasticPoolInner> object if successful. + */ + public PagedList listByServer(final String resourceGroupName, final String serverName, final Integer skip) { + ServiceResponse> response = listByServerSinglePageAsync(resourceGroupName, serverName, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @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 Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(resourceGroupName, serverName, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> object + */ + public Observable> listByServerAsync(final String resourceGroupName, final String serverName, final Integer skip) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName, final Integer skip) { + return listByServerSinglePageAsync(resourceGroupName, serverName, skip) + .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 elastic pools in 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. + ServiceResponse> * @param skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName, final Integer skip) { + 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(), skip, 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 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. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Gets 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. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(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.get(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 = 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 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. + * @param parameters The elastic pool parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner createOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @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 elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (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 (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, elasticPoolName, 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 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. + * @param parameters The elastic pool parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @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 elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (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 (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, elasticPoolName, 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 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. + * @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 elasticPoolName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().last().body(); + } + + /** + * Deletes 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. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(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.delete(resourceGroupName, serverName, elasticPoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes 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. + * @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 elasticPoolName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Deletes 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. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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 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. + * @param parameters The elastic pool update parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner update(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @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 serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (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 (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, serverName, elasticPoolName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @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 serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (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 (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, serverName, elasticPoolName, 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 all elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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<ElasticPoolInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/IdParsingUtils.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..f3a451c596501 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2017_10_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupImpl.java new file mode 100644 index 0000000000000..33052179c6996 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.PartnerRegionInfo; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstancePairInfo; + +class InstanceFailoverGroupImpl extends CreatableUpdatableImpl implements InstanceFailoverGroup, InstanceFailoverGroup.Definition, InstanceFailoverGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String locationName; + private String failoverGroupName; + + InstanceFailoverGroupImpl(String name, SqlManager manager) { + super(name, new InstanceFailoverGroupInner()); + this.manager = manager; + // Set resource name + this.failoverGroupName = name; + // + } + + InstanceFailoverGroupImpl(InstanceFailoverGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.failoverGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.failoverGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "instanceFailoverGroups"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.locationName, this.failoverGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.locationName, this.failoverGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.getAsync(this.resourceGroupName, this.locationName, this.failoverGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List managedInstancePairs() { + return this.inner().managedInstancePairs(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List partnerRegions() { + return this.inner().partnerRegions(); + } + + @Override + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.inner().readOnlyEndpoint(); + } + + @Override + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.inner().readWriteEndpoint(); + } + + @Override + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.inner().replicationRole(); + } + + @Override + public String replicationState() { + return this.inner().replicationState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public InstanceFailoverGroupImpl withExistingLocation(String resourceGroupName, String locationName) { + this.resourceGroupName = resourceGroupName; + this.locationName = locationName; + return this; + } + + @Override + public InstanceFailoverGroupImpl withManagedInstancePairs(List managedInstancePairs) { + this.inner().withManagedInstancePairs(managedInstancePairs); + return this; + } + + @Override + public InstanceFailoverGroupImpl withPartnerRegions(List partnerRegions) { + this.inner().withPartnerRegions(partnerRegions); + return this; + } + + @Override + public InstanceFailoverGroupImpl withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.inner().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + @Override + public InstanceFailoverGroupImpl withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.inner().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupInner.java new file mode 100644 index 0000000000000..2d21fd0ea3782 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupInner.java @@ -0,0 +1,161 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.PartnerRegionInfo; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstancePairInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An instance failover group. + */ +@JsonFlatten +public class InstanceFailoverGroupInner extends ProxyResource { + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint", required = true) + private InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * Local replication role of the failover group instance. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /** + * Partner region information for the failover group. + */ + @JsonProperty(value = "properties.partnerRegions", required = true) + private List partnerRegions; + + /** + * List of managed instance pairs in the failover group. + */ + @JsonProperty(value = "properties.managedInstancePairs", required = true) + private List managedInstancePairs; + + /** + * Get read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get replication state of the failover group instance. + * + * @return the replicationState value + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get partner region information for the failover group. + * + * @return the partnerRegions value + */ + public List partnerRegions() { + return this.partnerRegions; + } + + /** + * Set partner region information for the failover group. + * + * @param partnerRegions the partnerRegions value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withPartnerRegions(List partnerRegions) { + this.partnerRegions = partnerRegions; + return this; + } + + /** + * Get list of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value + */ + public List managedInstancePairs() { + return this.managedInstancePairs; + } + + /** + * Set list of managed instance pairs in the failover group. + * + * @param managedInstancePairs the managedInstancePairs value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withManagedInstancePairs(List managedInstancePairs) { + this.managedInstancePairs = managedInstancePairs; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsImpl.java new file mode 100644 index 0000000000000..1cb58ee5e90f3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsImpl.java @@ -0,0 +1,105 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroup; + +class InstanceFailoverGroupsImpl extends WrapperImpl implements InstanceFailoverGroups { + private final SqlManager manager; + + InstanceFailoverGroupsImpl(SqlManager manager) { + super(manager.inner().instanceFailoverGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public InstanceFailoverGroupImpl define(String name) { + return wrapModel(name); + } + + private InstanceFailoverGroupImpl wrapModel(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + + private InstanceFailoverGroupImpl wrapModel(String name) { + return new InstanceFailoverGroupImpl(name, this.manager()); + } + + @Override + public Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.forceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByLocationAsync(final String resourceGroupName, final String locationName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.listByLocationAsync(resourceGroupName, locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, locationName, failoverGroupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java new file mode 100644 index 0000000000000..ccc3f136d597f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java @@ -0,0 +1,1134 @@ +/** + * 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.v2017_10_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.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 InstanceFailoverGroups. + */ +public class InstanceFailoverGroupsInner { + /** The Retrofit service to perform REST calls. */ + private InstanceFailoverGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of InstanceFailoverGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstanceFailoverGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(InstanceFailoverGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InstanceFailoverGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface InstanceFailoverGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v2017_10_01_preview.InstanceFailoverGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner 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.v2017_10_01_preview.InstanceFailoverGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner 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.v2017_10_01_preview.InstanceFailoverGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v2017_10_01_preview.InstanceFailoverGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v2017_10_01_preview.InstanceFailoverGroups listByLocation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups") + Observable> listByLocation(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @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.v2017_10_01_preview.InstanceFailoverGroups failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v2017_10_01_preview.InstanceFailoverGroups beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v2017_10_01_preview.InstanceFailoverGroups forceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> forceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v2017_10_01_preview.InstanceFailoverGroups beginForceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> beginForceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v2017_10_01_preview.InstanceFailoverGroups listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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 failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner createOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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 failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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 failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @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<InstanceFailoverGroupInner> object if successful. + */ + public PagedList listByLocation(final String resourceGroupName, final String locationName) { + ServiceResponse> response = listByLocationSinglePageAsync(resourceGroupName, locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @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 resourceGroupName, final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(resourceGroupName, locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable> listByLocationAsync(final String resourceGroupName, final String locationName) { + return listByLocationWithServiceResponseAsync(resourceGroupName, locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName) { + return listByLocationSinglePageAsync(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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstanceFailoverGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(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."); + } + return service.listByLocation(resourceGroupName, locationName, 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 = 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); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner failover(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginFailover(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> forceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginForceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, 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 = beginForceFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginForceFailoverAllowDataLossDelegate(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 the failover groups in a 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<InstanceFailoverGroupInner> 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 failover groups in a 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 failover groups in a 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<InstanceFailoverGroupInner> 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 failover groups in a 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<InstanceFailoverGroupInner> 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 failover groups in a 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<InstanceFailoverGroupInner> 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); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesImpl.java new file mode 100644 index 0000000000000..b79a07299369d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.LocationCapabilities; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CapabilityStatus; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVersionCapability; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVersionCapability; + +class LocationCapabilitiesImpl extends WrapperImpl implements LocationCapabilities { + private final SqlManager manager; + LocationCapabilitiesImpl(LocationCapabilitiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reason() { + return this.inner().reason(); + } + + @Override + public CapabilityStatus status() { + return this.inner().status(); + } + + @Override + public List supportedManagedInstanceVersions() { + return this.inner().supportedManagedInstanceVersions(); + } + + @Override + public List supportedServerVersions() { + return this.inner().supportedServerVersions(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesInner.java new file mode 100644 index 0000000000000..b92c8fea2312a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesInner.java @@ -0,0 +1,108 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVersionCapability; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVersionCapability; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CapabilityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The location capability. + */ +public class LocationCapabilitiesInner { + /** + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported server versions. + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerVersions; + + /** + * The list of supported managed instance versions. + */ + @JsonProperty(value = "supportedManagedInstanceVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedManagedInstanceVersions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the location name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported server versions. + * + * @return the supportedServerVersions value + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Get the list of supported managed instance versions. + * + * @return the supportedManagedInstanceVersions value + */ + public List supportedManagedInstanceVersions() { + return this.supportedManagedInstanceVersions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the LocationCapabilitiesInner object itself. + */ + public LocationCapabilitiesInner withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesImpl.java new file mode 100644 index 0000000000000..3d9b36512d2c4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates; +import rx.Completable; + +class ManagedInstanceTdeCertificatesImpl extends WrapperImpl implements ManagedInstanceTdeCertificates { + private final SqlManager manager; + + ManagedInstanceTdeCertificatesImpl(SqlManager manager) { + super(manager.inner().managedInstanceTdeCertificates()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + ManagedInstanceTdeCertificatesInner client = this.inner(); + return client.createAsync(resourceGroupName, managedInstanceName, parameters).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java new file mode 100644 index 0000000000000..c2a8ab92c68fe --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_10_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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +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 ManagedInstanceTdeCertificates. + */ +public class ManagedInstanceTdeCertificatesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceTdeCertificatesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceTdeCertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceTdeCertificatesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceTdeCertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceTdeCertificates to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceTdeCertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner 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.v2017_10_01_preview.ManagedInstanceTdeCertificates beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 + */ + public void create(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner 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.create(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 + */ + public void beginCreate(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner 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.beginCreate(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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/PageImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..aaa1dee8d9040 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..b432eec9c06a4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DatabaseOperationsInner object to access its operations. + */ + private DatabaseOperationsInner databaseOperations; + + /** + * Gets the DatabaseOperationsInner object to access its operations. + * @return the DatabaseOperationsInner object. + */ + public DatabaseOperationsInner databaseOperations() { + return this.databaseOperations; + } + + /** + * The ElasticPoolOperationsInner object to access its operations. + */ + private ElasticPoolOperationsInner elasticPoolOperations; + + /** + * Gets the ElasticPoolOperationsInner object to access its operations. + * @return the ElasticPoolOperationsInner object. + */ + public ElasticPoolOperationsInner elasticPoolOperations() { + return this.elasticPoolOperations; + } + + /** + * The DatabaseVulnerabilityAssessmentScansInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans; + + /** + * Gets the DatabaseVulnerabilityAssessmentScansInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentScansInner object. + */ + public DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans() { + return this.databaseVulnerabilityAssessmentScans; + } + + /** + * The CapabilitiesInner object to access its operations. + */ + private CapabilitiesInner capabilities; + + /** + * Gets the CapabilitiesInner object to access its operations. + * @return the CapabilitiesInner object. + */ + public CapabilitiesInner capabilities() { + return this.capabilities; + } + + /** + * 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 InstanceFailoverGroupsInner object to access its operations. + */ + private InstanceFailoverGroupsInner instanceFailoverGroups; + + /** + * Gets the InstanceFailoverGroupsInner object to access its operations. + * @return the InstanceFailoverGroupsInner object. + */ + public InstanceFailoverGroupsInner instanceFailoverGroups() { + return this.instanceFailoverGroups; + } + + /** + * The BackupShortTermRetentionPoliciesInner object to access its operations. + */ + private BackupShortTermRetentionPoliciesInner backupShortTermRetentionPolicies; + + /** + * Gets the BackupShortTermRetentionPoliciesInner object to access its operations. + * @return the BackupShortTermRetentionPoliciesInner object. + */ + public BackupShortTermRetentionPoliciesInner backupShortTermRetentionPolicies() { + return this.backupShortTermRetentionPolicies; + } + + /** + * The TdeCertificatesInner object to access its operations. + */ + private TdeCertificatesInner tdeCertificates; + + /** + * Gets the TdeCertificatesInner object to access its operations. + * @return the TdeCertificatesInner object. + */ + public TdeCertificatesInner tdeCertificates() { + return this.tdeCertificates; + } + + /** + * The ManagedInstanceTdeCertificatesInner object to access its operations. + */ + private ManagedInstanceTdeCertificatesInner managedInstanceTdeCertificates; + + /** + * Gets the ManagedInstanceTdeCertificatesInner object to access its operations. + * @return the ManagedInstanceTdeCertificatesInner object. + */ + public ManagedInstanceTdeCertificatesInner managedInstanceTdeCertificates() { + return this.managedInstanceTdeCertificates; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-10-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); + this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); + this.instanceFailoverGroups = new InstanceFailoverGroupsInner(restClient().retrofit(), this); + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); + this.tdeCertificates = new TdeCertificatesInner(restClient().retrofit(), this); + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2017-10-01-preview"); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java new file mode 100644 index 0000000000000..b0ae252b7525a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java @@ -0,0 +1,207 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Databases; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPools; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups; +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2017_10_01_preview.TdeCertificates; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private DatabaseOperations databaseOperations; + private ElasticPoolOperations elasticPoolOperations; + private DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans; + private Capabilities capabilities; + private Databases databases; + private ElasticPools elasticPools; + private InstanceFailoverGroups instanceFailoverGroups; + private BackupShortTermRetentionPolicies backupShortTermRetentionPolicies; + private TdeCertificates tdeCertificates; + private ManagedInstanceTdeCertificates managedInstanceTdeCertificates; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DatabaseOperations. + */ + public DatabaseOperations databaseOperations() { + if (this.databaseOperations == null) { + this.databaseOperations = new DatabaseOperationsImpl(this); + } + return this.databaseOperations; + } + + /** + * @return Entry point to manage ElasticPoolOperations. + */ + public ElasticPoolOperations elasticPoolOperations() { + if (this.elasticPoolOperations == null) { + this.elasticPoolOperations = new ElasticPoolOperationsImpl(this); + } + return this.elasticPoolOperations; + } + + /** + * @return Entry point to manage DatabaseVulnerabilityAssessmentScans. + */ + public DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans() { + if (this.databaseVulnerabilityAssessmentScans == null) { + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansImpl(this); + } + return this.databaseVulnerabilityAssessmentScans; + } + + /** + * @return Entry point to manage Capabilities. + */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(this); + } + return this.capabilities; + } + + /** + * @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 InstanceFailoverGroups. + */ + public InstanceFailoverGroups instanceFailoverGroups() { + if (this.instanceFailoverGroups == null) { + this.instanceFailoverGroups = new InstanceFailoverGroupsImpl(this); + } + return this.instanceFailoverGroups; + } + + /** + * @return Entry point to manage BackupShortTermRetentionPolicies. + */ + public BackupShortTermRetentionPolicies backupShortTermRetentionPolicies() { + if (this.backupShortTermRetentionPolicies == null) { + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesImpl(this); + } + return this.backupShortTermRetentionPolicies; + } + + /** + * @return Entry point to manage TdeCertificates. + */ + public TdeCertificates tdeCertificates() { + if (this.tdeCertificates == null) { + this.tdeCertificates = new TdeCertificatesImpl(this); + } + return this.tdeCertificates; + } + + /** + * @return Entry point to manage ManagedInstanceTdeCertificates. + */ + public ManagedInstanceTdeCertificates managedInstanceTdeCertificates() { + if (this.managedInstanceTdeCertificates == null) { + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesImpl(this); + } + return this.managedInstanceTdeCertificates; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificateInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificateInner.java new file mode 100644 index 0000000000000..e027ce9d00efc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificateInner.java @@ -0,0 +1,72 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A TDE certificate that can be uploaded into a server. + */ +@JsonFlatten +public class TdeCertificateInner extends ProxyResource { + /** + * The base64 encoded certificate private blob. + */ + @JsonProperty(value = "properties.privateBlob", required = true) + private String privateBlob; + + /** + * The certificate password. + */ + @JsonProperty(value = "properties.certPassword") + private String certPassword; + + /** + * Get the base64 encoded certificate private blob. + * + * @return the privateBlob value + */ + public String privateBlob() { + return this.privateBlob; + } + + /** + * Set the base64 encoded certificate private blob. + * + * @param privateBlob the privateBlob value to set + * @return the TdeCertificateInner object itself. + */ + public TdeCertificateInner withPrivateBlob(String privateBlob) { + this.privateBlob = privateBlob; + return this; + } + + /** + * Get the certificate password. + * + * @return the certPassword value + */ + public String certPassword() { + return this.certPassword; + } + + /** + * Set the certificate password. + * + * @param certPassword the certPassword value to set + * @return the TdeCertificateInner object itself. + */ + public TdeCertificateInner withCertPassword(String certPassword) { + this.certPassword = certPassword; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesImpl.java new file mode 100644 index 0000000000000..533f1c3abc3f2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.TdeCertificates; +import rx.Completable; + +class TdeCertificatesImpl extends WrapperImpl implements TdeCertificates { + private final SqlManager manager; + + TdeCertificatesImpl(SqlManager manager) { + super(manager.inner().tdeCertificates()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + TdeCertificatesInner client = this.inner(); + return client.createAsync(resourceGroupName, serverName, parameters).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesInner.java new file mode 100644 index 0000000000000..054350745555f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_10_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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +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 TdeCertificates. + */ +public class TdeCertificatesInner { + /** The Retrofit service to perform REST calls. */ + private TdeCertificatesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TdeCertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TdeCertificatesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TdeCertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TdeCertificates to be + * used by Retrofit to perform actually REST calls. + */ + interface TdeCertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.TdeCertificates create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/tdeCertificates") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner 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.v2017_10_01_preview.TdeCertificates beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/tdeCertificates") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 + */ + public void create(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + createWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, TdeCertificateInner 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 (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.create(resourceGroupName, serverName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 + */ + public void beginCreate(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 beginCreateAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, TdeCertificateInner 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 (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.beginCreate(resourceGroupName, serverName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..fdeb3a2d3dea3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; + +class VulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements VulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String scanId; + + VulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().databaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordInner.java new file mode 100644 index 0000000000000..a5e6ea17fed97 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordInner.java @@ -0,0 +1,146 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A vulnerability assessment scan record. + */ +@JsonFlatten +public class VulnerabilityAssessmentScanRecordInner extends ProxyResource { + /** + * The scan ID. + */ + @JsonProperty(value = "properties.scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /** + * The scan trigger type. Possible values include: 'OnDemand', 'Recurring'. + */ + @JsonProperty(value = "properties.triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /** + * The scan status. Possible values include: 'Passed', 'Failed', + * 'FailedToRun', 'InProgress'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /** + * The scan start time (UTC). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The scan end time (UTC). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The scan errors. + */ + @JsonProperty(value = "properties.errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * The scan results storage container path. + */ + @JsonProperty(value = "properties.storageContainerPath", access = JsonProperty.Access.WRITE_ONLY) + private String storageContainerPath; + + /** + * The number of failed security checks. + */ + @JsonProperty(value = "properties.numberOfFailedSecurityChecks", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFailedSecurityChecks; + + /** + * Get the scan ID. + * + * @return the scanId value + */ + public String scanId() { + return this.scanId; + } + + /** + * Get the scan trigger type. Possible values include: 'OnDemand', 'Recurring'. + * + * @return the triggerType value + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Get the scan status. Possible values include: 'Passed', 'Failed', 'FailedToRun', 'InProgress'. + * + * @return the state value + */ + public VulnerabilityAssessmentScanState state() { + return this.state; + } + + /** + * Get the scan start time (UTC). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the scan end time (UTC). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the scan errors. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Get the scan results storage container path. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Get the number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value + */ + public Integer numberOfFailedSecurityChecks() { + return this.numberOfFailedSecurityChecks; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/package-info.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..e71fc9e7ca0a4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2017_10_01_preview.implementation; diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/package-info.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/package-info.java new file mode 100644 index 0000000000000..113915f242e8f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2017_10_01_preview; From ebe152731be6c89b1a99d99153099288c3185ad9 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 27 Jul 2018 13:48:16 -0700 Subject: [PATCH 02/17] [AutoPR sql/resource-manager] [DO NOT MERGE] Add DatabaseVulnerabilityAssessments swagger (#2117) * Generated from 9f34855928e5b0e9aa638145a56f5d6c7daacb40 Add DatabaseVulnerabilityAssessments swagger The put api is updated. A new parameter is added to its body properties storageAccountAccessKey. storageContainerSasKey isn't required anymore, but the user must to specified one of the following parameters: storageContainerSasKey or storageAccountAccessKey * Generated from 7f90a833cdce20259526b7d4e4bdf614eb000f75 update databaseVulnerabilityAssessments for version 2017-03 add storageContainerPath to properties as optional parameters From b3d6e01e0317ff34456b7b165f881e2e98fac31d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 4 Sep 2018 13:19:46 -0700 Subject: [PATCH 03/17] [AutoPR sql/resource-manager] New Cmdlets for Management.Sql to allow customers to add TDE keys and set TDE protector (#2351) * Generated from bdb271f9fc7fa148176e6470e7e5b27cc2450c73 Changes for ManagedInstanceEncryptionProtectors * Generated from 724082f8646ab05191f7eee135fd674fd26d1a94 Changing operation id to ListByInstance as per Jared's recommendation * Generated from f5321fc054067d1d4e8937cfc92452bf4a6a4950 Addressed comments By @anuchandy - Changed comment to created or updated - changed operation if to listByInstance --- .../ManagedInstanceEncryptionProtector.java | 60 ++ .../ManagedInstanceEncryptionProtectors.java | 51 + .../ManagedInstanceKey.java | 141 +++ .../ManagedInstanceKeys.java | 53 ++ .../v2017_10_01_preview/ServerKeyType.java | 41 + ...anagedInstanceEncryptionProtectorImpl.java | 67 ++ ...nagedInstanceEncryptionProtectorInner.java | 120 +++ ...nagedInstanceEncryptionProtectorsImpl.java | 73 ++ ...agedInstanceEncryptionProtectorsInner.java | 580 +++++++++++ .../ManagedInstanceKeyImpl.java | 133 +++ .../ManagedInstanceKeyInner.java | 122 +++ .../ManagedInstanceKeysImpl.java | 81 ++ .../ManagedInstanceKeysInner.java | 899 ++++++++++++++++++ .../SqlManagementClientImpl.java | 28 + .../implementation/SqlManager.java | 24 + 15 files changed, 2473 insertions(+) create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtector.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKey.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKeys.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerKeyType.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtector.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtector.java new file mode 100644 index 0000000000000..6c16d10ffdc67 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtector.java @@ -0,0 +1,60 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceEncryptionProtectorInner; + +/** + * Type representing ManagedInstanceEncryptionProtector. + */ +public interface ManagedInstanceEncryptionProtector extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java new file mode 100644 index 0000000000000..228e27215ed8e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java @@ -0,0 +1,51 @@ +/** + * 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.v2017_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceEncryptionProtectorInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceEncryptionProtectorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceEncryptionProtectors. + */ +public interface ManagedInstanceEncryptionProtectors extends HasInner { + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The 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); + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 getAsync(String resourceGroupName, String managedInstanceName); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKey.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKey.java new file mode 100644 index 0000000000000..a69ab0744afb6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKey.java @@ -0,0 +1,141 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceKeyInner; +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.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ManagedInstanceKey. + */ +public interface ManagedInstanceKey extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + + /** + * The entirety of the ManagedInstanceKey definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithServerKeyType, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstanceKey definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstanceKey definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the managedinstancekey definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + */ + WithServerKeyType withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the managedinstancekey definition allowing to specify ServerKeyType. + */ + interface WithServerKeyType { + /** + * Specifies serverKeyType. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + + /** + * The stage of the managedinstancekey definition allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + WithCreate withUri(String uri); + } + + /** + * 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.WithUri { + } + } + /** + * The template for a ManagedInstanceKey update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithUri { + } + + /** + * Grouping of ManagedInstanceKey update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstancekey update allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + Update withUri(String uri); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKeys.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKeys.java new file mode 100644 index 0000000000000..320d0d09266ed --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceKeys.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.v2017_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceKeys. + */ +public interface ManagedInstanceKeys extends SupportsCreating, HasInner { + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String keyName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerKeyType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerKeyType.java new file mode 100644 index 0000000000000..d13b712b173e3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerKeyType.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.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServerKeyType. + */ +public final class ServerKeyType extends ExpandableStringEnum { + /** Static value ServiceManaged for ServerKeyType. */ + public static final ServerKeyType SERVICE_MANAGED = fromString("ServiceManaged"); + + /** Static value AzureKeyVault for ServerKeyType. */ + public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates or finds a ServerKeyType from its string representation. + * @param name a name to look for + * @return the corresponding ServerKeyType + */ + @JsonCreator + public static ServerKeyType fromString(String name) { + return fromString(name, ServerKeyType.class); + } + + /** + * @return known ServerKeyType values + */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorImpl.java new file mode 100644 index 0000000000000..dcfd21c06f2e3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorImpl.java @@ -0,0 +1,67 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtector; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerKeyType; + +class ManagedInstanceEncryptionProtectorImpl extends WrapperImpl implements ManagedInstanceEncryptionProtector { + private final SqlManager manager; + ManagedInstanceEncryptionProtectorImpl(ManagedInstanceEncryptionProtectorInner 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 kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serverKeyName() { + return this.inner().serverKeyName(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorInner.java new file mode 100644 index 0000000000000..42b50da5e4d9e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorInner.java @@ -0,0 +1,120 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The managed instance encryption protector. + */ +@JsonFlatten +public class ManagedInstanceEncryptionProtectorInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The name of the managed instance key. + */ + @JsonProperty(value = "properties.serverKeyName") + private String serverKeyName; + + /** + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * Possible values include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the name of the managed instance key. + * + * @return the serverKeyName value + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the name of the managed instance key. + * + * @param serverKeyName the serverKeyName value to set + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the server key. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get thumbprint of the server key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..f5e79e61090bf --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java @@ -0,0 +1,73 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtector; + +class ManagedInstanceEncryptionProtectorsImpl extends WrapperImpl implements ManagedInstanceEncryptionProtectors { + private final SqlManager manager; + + ManagedInstanceEncryptionProtectorsImpl(SqlManager manager) { + super(manager.inner().managedInstanceEncryptionProtectors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedInstanceEncryptionProtectorsInner 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 ManagedInstanceEncryptionProtector call(ManagedInstanceEncryptionProtectorInner inner) { + return new ManagedInstanceEncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstanceEncryptionProtectorsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedInstanceEncryptionProtector call(ManagedInstanceEncryptionProtectorInner inner) { + return new ManagedInstanceEncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + ManagedInstanceEncryptionProtectorsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters) + .map(new Func1() { + @Override + public ManagedInstanceEncryptionProtector call(ManagedInstanceEncryptionProtectorInner inner) { + return new ManagedInstanceEncryptionProtectorImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java new file mode 100644 index 0000000000000..303c257a8ea71 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java @@ -0,0 +1,580 @@ +/** + * 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.v2017_10_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 ManagedInstanceEncryptionProtectors. + */ +public class ManagedInstanceEncryptionProtectorsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceEncryptionProtectorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceEncryptionProtectorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceEncryptionProtectorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceEncryptionProtectorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceEncryptionProtectors to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceEncryptionProtectorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector") + 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.v2017_10_01_preview.ManagedInstanceEncryptionProtectors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @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.v2017_10_01_preview.ManagedInstanceEncryptionProtectors createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceEncryptionProtectorInner 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.v2017_10_01_preview.ManagedInstanceEncryptionProtectors beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceEncryptionProtectorInner 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.v2017_10_01_preview.ManagedInstanceEncryptionProtectors listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @param resourceGroupName The 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 instance encryption protectors. + * + * @param resourceGroupName The 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @param resourceGroupName The 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protector. + * + * @param resourceGroupName The 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 ManagedInstanceEncryptionProtectorInner object if successful. + */ + public ManagedInstanceEncryptionProtectorInner get(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 getAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 ManagedInstanceEncryptionProtectorInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedInstanceEncryptionProtectorInner>() { + @Override + public ManagedInstanceEncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 ManagedInstanceEncryptionProtectorInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String encryptionProtectorName = "current"; + return service.get(resourceGroupName, managedInstanceName, encryptionProtectorName, 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); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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 ManagedInstanceEncryptionProtectorInner object if successful. + */ + public ManagedInstanceEncryptionProtectorInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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, ManagedInstanceEncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceEncryptionProtectorInner>() { + @Override + public ManagedInstanceEncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner 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); + final String encryptionProtectorName = "current"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, encryptionProtectorName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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 ManagedInstanceEncryptionProtectorInner object if successful. + */ + public ManagedInstanceEncryptionProtectorInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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, ManagedInstanceEncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceEncryptionProtectorInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceEncryptionProtectorInner>() { + @Override + public ManagedInstanceEncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceEncryptionProtectorInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner 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); + final String encryptionProtectorName = "current"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, encryptionProtectorName, 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 list of managed instance encryption protectors. + * + * @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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @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 instance encryption protectors. + * + * @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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceEncryptionProtectorInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyImpl.java new file mode 100644 index 0000000000000..473b1359e9abe --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceKey; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerKeyType; +import org.joda.time.DateTime; + +class ManagedInstanceKeyImpl extends CreatableUpdatableImpl implements ManagedInstanceKey, ManagedInstanceKey.Definition, ManagedInstanceKey.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String keyName; + + ManagedInstanceKeyImpl(String name, SqlManager manager) { + super(name, new ManagedInstanceKeyInner()); + this.manager = manager; + // Set resource name + this.keyName = name; + // + } + + ManagedInstanceKeyImpl(ManagedInstanceKeyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.keyName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.keyName = IdParsingUtils.getValueFromIdByName(inner.id(), "keys"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedInstanceKeysInner client = this.manager().inner().managedInstanceKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedInstanceKeysInner client = this.manager().inner().managedInstanceKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedInstanceKeysInner client = this.manager().inner().managedInstanceKeys(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.keyName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + + @Override + public ManagedInstanceKeyImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedInstanceKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.inner().withServerKeyType(serverKeyType); + return this; + } + + @Override + public ManagedInstanceKeyImpl withUri(String uri) { + this.inner().withUri(uri); + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyInner.java new file mode 100644 index 0000000000000..a47293a0e0b4f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeyInner.java @@ -0,0 +1,122 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerKeyType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed instance key. + */ +@JsonFlatten +public class ManagedInstanceKeyInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The key type like 'ServiceManaged', 'AzureKeyVault'. Possible values + * include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI + * is required. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /** + * Thumbprint of the key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * The key creation date. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the ManagedInstanceKeyInner object itself. + */ + public ManagedInstanceKeyInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set + * @return the ManagedInstanceKeyInner object itself. + */ + public ManagedInstanceKeyInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get thumbprint of the key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the key creation date. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysImpl.java new file mode 100644 index 0000000000000..5ec3eb2e0a0a6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceKeys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceKey; + +class ManagedInstanceKeysImpl extends WrapperImpl implements ManagedInstanceKeys { + private final SqlManager manager; + + ManagedInstanceKeysImpl(SqlManager manager) { + super(manager.inner().managedInstanceKeys()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedInstanceKeyImpl define(String name) { + return wrapModel(name); + } + + private ManagedInstanceKeyImpl wrapModel(ManagedInstanceKeyInner inner) { + return new ManagedInstanceKeyImpl(inner, manager()); + } + + private ManagedInstanceKeyImpl wrapModel(String name) { + return new ManagedInstanceKeyImpl(name, this.manager()); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedInstanceKeysInner 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 ManagedInstanceKey call(ManagedInstanceKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String keyName) { + ManagedInstanceKeysInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, keyName) + .map(new Func1() { + @Override + public ManagedInstanceKey call(ManagedInstanceKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String keyName) { + ManagedInstanceKeysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, keyName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java new file mode 100644 index 0000000000000..ed9e145496ddf --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java @@ -0,0 +1,899 @@ +/** + * 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.v2017_10_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 ManagedInstanceKeys. + */ +public class ManagedInstanceKeysInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceKeysService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceKeysInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceKeys listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys") + Observable> listByInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.v2017_10_01_preview.ManagedInstanceKeys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @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.v2017_10_01_preview.ManagedInstanceKeys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceKeyInner 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.v2017_10_01_preview.ManagedInstanceKeys beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceKeyInner 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.v2017_10_01_preview.ManagedInstanceKeys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @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.v2017_10_01_preview.ManagedInstanceKeys beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @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.v2017_10_01_preview.ManagedInstanceKeys listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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<ManagedInstanceKeyInner> 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 instance keys. + * + * @param resourceGroupName The 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 instance keys. + * + * @param resourceGroupName The 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<ManagedInstanceKeyInner> 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 instance keys. + * + * @param resourceGroupName The 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<ManagedInstanceKeyInner> 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 instance keys. + * + * @param resourceGroupName The 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 PagedList<ManagedInstanceKeyInner> 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."); + } + final String filter = null; + return service.listByInstance(resourceGroupName, managedInstanceName, 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 = listByInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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<ManagedInstanceKeyInner> object if successful. + */ + public PagedList listByInstance(final String resourceGroupName, final String managedInstanceName, final String filter) { + ServiceResponse> response = listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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<ManagedInstanceKeyInner> object + */ + public Observable> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName, final String filter) { + return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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<ManagedInstanceKeyInner> object + */ + public Observable>> listByInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String filter) { + return listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, 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(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed instance keys. + * + 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 filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceKeyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceSinglePageAsync(final String resourceGroupName, final String managedInstanceName, 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 (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(), filter, 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 instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key 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 ManagedInstanceKeyInner object if successful. + */ + public ManagedInstanceKeyInner get(String resourceGroupName, String managedInstanceName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).toBlocking().single().body(); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key 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 getAsync(String resourceGroupName, String managedInstanceName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName), serviceCallback); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).map(new Func1, ManagedInstanceKeyInner>() { + @Override + public ManagedInstanceKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 ManagedInstanceKeyInner object if successful. + */ + public ManagedInstanceKeyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 keyName, ManagedInstanceKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).map(new Func1, ManagedInstanceKeyInner>() { + @Override + public ManagedInstanceKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 ManagedInstanceKeyInner object if successful. + */ + public ManagedInstanceKeyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 keyName, ManagedInstanceKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).map(new Func1, ManagedInstanceKeyInner>() { + @Override + public ManagedInstanceKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).toBlocking().last().body(); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName), serviceCallback); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName, String keyName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).toBlocking().single().body(); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName), serviceCallback); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String managedInstanceName, String keyName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 a list of managed instance keys. + * + * @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<ManagedInstanceKeyInner> 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 instance keys. + * + * @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 instance keys. + * + * @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<ManagedInstanceKeyInner> 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 instance keys. + * + * @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<ManagedInstanceKeyInner> 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 instance keys. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceKeyInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java index b432eec9c06a4..296cf77e06882 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java @@ -262,6 +262,32 @@ public ManagedInstanceTdeCertificatesInner managedInstanceTdeCertificates() { return this.managedInstanceTdeCertificates; } + /** + * The ManagedInstanceKeysInner object to access its operations. + */ + private ManagedInstanceKeysInner managedInstanceKeys; + + /** + * Gets the ManagedInstanceKeysInner object to access its operations. + * @return the ManagedInstanceKeysInner object. + */ + public ManagedInstanceKeysInner managedInstanceKeys() { + return this.managedInstanceKeys; + } + + /** + * The ManagedInstanceEncryptionProtectorsInner object to access its operations. + */ + private ManagedInstanceEncryptionProtectorsInner managedInstanceEncryptionProtectors; + + /** + * Gets the ManagedInstanceEncryptionProtectorsInner object to access its operations. + * @return the ManagedInstanceEncryptionProtectorsInner object. + */ + public ManagedInstanceEncryptionProtectorsInner managedInstanceEncryptionProtectors() { + return this.managedInstanceEncryptionProtectors; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -307,6 +333,8 @@ protected void initialize() { this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); this.tdeCertificates = new TdeCertificatesInner(restClient().retrofit(), this); this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesInner(restClient().retrofit(), this); + this.managedInstanceKeys = new ManagedInstanceKeysInner(restClient().retrofit(), this); + this.managedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java index b0ae252b7525a..6677354b17e33 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java @@ -26,6 +26,8 @@ import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies; import com.microsoft.azure.management.sql.v2017_10_01_preview.TdeCertificates; import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceKeys; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -43,6 +45,8 @@ public final class SqlManager extends ManagerCore Date: Mon, 17 Sep 2018 09:59:08 -0700 Subject: [PATCH 04/17] Generated from ae5e50da51607b6c59745d9d2969c4f6acba0d81 (#2385) Add algorithm types to threat detection disabled alerts description Added Data_Exfiltration and Unsafe_Action as allowed values to disabled alert. --- .../implementation/DatabaseSecurityAlertPolicyInner.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java index 7a528d7a582eb..1e92ff6db0b17 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java @@ -43,7 +43,8 @@ public class DatabaseSecurityAlertPolicyInner extends ProxyResource { /** * Specifies the semicolon-separated list of alerts that are disabled, or * empty string to disable no alerts. Possible values: Sql_Injection; - * Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; + * Unsafe_Action. */ @JsonProperty(value = "properties.disabledAlerts") private String disabledAlerts; @@ -141,7 +142,7 @@ public DatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state } /** - * Get specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * Get specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. * * @return the disabledAlerts value */ @@ -150,7 +151,7 @@ public String disabledAlerts() { } /** - * Set specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * Set specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. * * @param disabledAlerts the disabledAlerts value to set * @return the DatabaseSecurityAlertPolicyInner object itself. From a03d0115a5dd68ea2cf28c151ddbb8fe55d9bbd2 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 4 Oct 2018 16:58:37 -0700 Subject: [PATCH 05/17] Generated from 1d3074c3f3f50b396875f414d62eec4195234f83 (#2451) Update readme.md --- .../DatabaseVulnerabilityAssessment.java | 189 +++-- ...seVulnerabilityAssessmentRuleBaseline.java | 111 +++ ...lnerabilityAssessmentRuleBaselineItem.java | 45 ++ .../DatabaseVulnerabilityAssessmentScans.java | 6 +- ...eVulnerabilityAssessmentRuleBaselines.java | 51 ++ ...dDatabaseVulnerabilityAssessmentScans.java | 67 ++ ...nagedDatabaseVulnerabilityAssessments.java | 47 ++ ...anceVulnerabilityAssessmentScanRecord.java | 79 ++ ...rverVulnerabilityAssessmentScanRecord.java | 79 ++ ...erabilityAssessmentPolicyBaselineName.java | 53 ++ .../DatabaseVulnerabilityAssessmentImpl.java | 140 ++++ .../DatabaseVulnerabilityAssessmentInner.java | 131 ++++ ...lnerabilityAssessmentRuleBaselineImpl.java | 120 +++ ...nerabilityAssessmentRuleBaselineInner.java | 48 ++ ...abaseVulnerabilityAssessmentScansImpl.java | 22 +- ...nerabilityAssessmentRuleBaselinesImpl.java | 72 ++ ...erabilityAssessmentRuleBaselinesInner.java | 408 ++++++++++ ...abaseVulnerabilityAssessmentScansImpl.java | 85 +++ ...baseVulnerabilityAssessmentScansInner.java | 717 ++++++++++++++++++ ...dDatabaseVulnerabilityAssessmentsImpl.java | 70 ++ ...DatabaseVulnerabilityAssessmentsInner.java | 362 +++++++++ ...VulnerabilityAssessmentScanRecordImpl.java | 104 +++ ...VulnerabilityAssessmentScanRecordImpl.java | 104 +++ .../SqlManagementClientImpl.java | 42 + .../implementation/SqlManager.java | 36 + 25 files changed, 3117 insertions(+), 71 deletions(-) create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java index b363f4918cf43..82e299cd0b656 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java @@ -8,93 +8,168 @@ package com.microsoft.azure.management.sql.v2017_10_01_preview; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.ProxyResource; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseVulnerabilityAssessmentInner; +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.v2017_10_01_preview.implementation.SqlManager; /** - * A database vulnerability assessment. + * Type representing DatabaseVulnerabilityAssessment. */ -@JsonFlatten -public class DatabaseVulnerabilityAssessment extends ProxyResource { +public interface DatabaseVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { /** - * A blob storage container path to hold the scan results (e.g. - * https://myStorage.blob.core.windows.net/VaScans/). + * @return the id value. */ - @JsonProperty(value = "properties.storageContainerPath", required = true) - private String storageContainerPath; + String id(); /** - * A shared access signature (SAS Key) that has write access to the blob - * container specified in 'storageContainerPath' parameter. + * @return the name value. */ - @JsonProperty(value = "properties.storageContainerSasKey", required = true) - private String storageContainerSasKey; + String name(); /** - * The recurring scans settings. + * @return the recurringScans value. */ - @JsonProperty(value = "properties.recurringScans") - private VulnerabilityAssessmentRecurringScansProperties recurringScans; + VulnerabilityAssessmentRecurringScansProperties recurringScans(); /** - * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - * - * @return the storageContainerPath value + * @return the storageAccountAccessKey value. */ - public String storageContainerPath() { - return this.storageContainerPath; - } + String storageAccountAccessKey(); /** - * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - * - * @param storageContainerPath the storageContainerPath value to set - * @return the DatabaseVulnerabilityAssessment object itself. + * @return the storageContainerPath value. */ - public DatabaseVulnerabilityAssessment withStorageContainerPath(String storageContainerPath) { - this.storageContainerPath = storageContainerPath; - return this; - } + String storageContainerPath(); /** - * Get a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. - * - * @return the storageContainerSasKey value + * @return the storageContainerSasKey value. */ - public String storageContainerSasKey() { - return this.storageContainerSasKey; - } + String storageContainerSasKey(); /** - * Set a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. - * - * @param storageContainerSasKey the storageContainerSasKey value to set - * @return the DatabaseVulnerabilityAssessment object itself. + * @return the type value. */ - public DatabaseVulnerabilityAssessment withStorageContainerSasKey(String storageContainerSasKey) { - this.storageContainerSasKey = storageContainerSasKey; - return this; - } + String type(); /** - * Get the recurring scans settings. - * - * @return the recurringScans value + * The entirety of the DatabaseVulnerabilityAssessment definition. */ - public VulnerabilityAssessmentRecurringScansProperties recurringScans() { - return this.recurringScans; + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithCreate { } /** - * Set the recurring scans settings. - * - * @param recurringScans the recurringScans value to set - * @return the DatabaseVulnerabilityAssessment object itself. + * Grouping of DatabaseVulnerabilityAssessment definition stages. */ - public DatabaseVulnerabilityAssessment withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { - this.recurringScans = recurringScans; - return this; + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessment definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithStorageContainerPath withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a DatabaseVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerSasKey { } + /** + * Grouping of DatabaseVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } } diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..3867a173423f1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseVulnerabilityAssessmentRuleBaselineInner; +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.v2017_10_01_preview.implementation.SqlManager; +import java.util.List; + +/** + * Type representing DatabaseVulnerabilityAssessmentRuleBaseline. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaseline extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the baselineResults value. + */ + List baselineResults(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRule, DefinitionStages.WithBaselineResults, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Blank extends WithRule { + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify Rule. + */ + interface WithRule { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName, ruleId. + */ + WithBaselineResults withExistingRule(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId); + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + WithCreate withBaselineResults(List baselineResults); + } + + /** + * 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 { + } + } + /** + * The template for a DatabaseVulnerabilityAssessmentRuleBaseline update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBaselineResults { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessmentrulebaseline update allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + Update withBaselineResults(List baselineResults); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 0000000000000..8af515f3ab257 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java @@ -0,0 +1,45 @@ +/** + * 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.v2017_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for an Azure SQL Database Vulnerability Assessment rule + * baseline's result. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /** + * The rule baseline result. + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** + * Get the rule baseline result. + * + * @return the result value + */ + public List result() { + return this.result; + } + + /** + * Set the rule baseline result. + * + * @param result the result value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineItem object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem withResult(List result) { + this.result = result; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java index b57f178bb0dcb..b06b176e94e2e 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java @@ -9,7 +9,7 @@ package com.microsoft.azure.management.sql.v2017_10_01_preview; import rx.Observable; -import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVulnerabilityAssessmentScanRecord; import rx.Completable; /** @@ -26,7 +26,7 @@ public interface DatabaseVulnerabilityAssessmentScans { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId); /** * Lists the vulnerability assessment scans of a database. @@ -37,7 +37,7 @@ public interface DatabaseVulnerabilityAssessmentScans { * @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); + Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName); /** * Executes a Vulnerability Assessment database scan. diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..e2ea17009a99b --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,51 @@ +/** + * 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.v2017_10_01_preview; + +import rx.Observable; +import rx.Completable; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ +public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + /** + * Begins definition for a new Baseline resource. + * @param name resource name. + * @return the first stage of the new Baseline definition. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank defineBaseline(String name); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..84eb0df1f5428 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,67 @@ +/** + * 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.v2017_10_01_preview; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedDatabaseVulnerabilityAssessmentScansInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessmentScans. + */ +public interface ManagedDatabaseVulnerabilityAssessmentScans extends HasInner { + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Lists the vulnerability assessment scans of 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 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..a968416a939b3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.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.v2017_10_01_preview; + +import rx.Observable; +import rx.Completable; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessments. + */ +public interface ManagedDatabaseVulnerabilityAssessments { + /** + * Begins definition for a new VulnerabilityAssessment resource. + * @param name resource name. + * @return the first stage of the new VulnerabilityAssessment definition. + */ + DatabaseVulnerabilityAssessment.DefinitionStages.Blank defineVulnerabilityAssessment(String name); + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..c47199200be6e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.VulnerabilityAssessmentScanRecordInner; +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.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ManagedInstanceVulnerabilityAssessmentScanRecord. + */ +public interface ManagedInstanceVulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..40d70282c88d5 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.VulnerabilityAssessmentScanRecordInner; +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.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ServerVulnerabilityAssessmentScanRecord. + */ +public interface ServerVulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.java new file mode 100644 index 0000000000000..8eb67b02d36a3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.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.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for VulnerabilityAssessmentPolicyBaselineName. + */ +public enum VulnerabilityAssessmentPolicyBaselineName { + /** Enum value master. */ + MASTER("master"), + + /** Enum value default. */ + DEFAULT("default"); + + /** The actual serialized value for a VulnerabilityAssessmentPolicyBaselineName instance. */ + private String value; + + VulnerabilityAssessmentPolicyBaselineName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a VulnerabilityAssessmentPolicyBaselineName instance. + * + * @param value the serialized value to parse. + * @return the parsed VulnerabilityAssessmentPolicyBaselineName object, or null if unable to parse. + */ + @JsonCreator + public static VulnerabilityAssessmentPolicyBaselineName fromString(String value) { + VulnerabilityAssessmentPolicyBaselineName[] items = VulnerabilityAssessmentPolicyBaselineName.values(); + for (VulnerabilityAssessmentPolicyBaselineName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..809982bc6711a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -0,0 +1,140 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentRecurringScansProperties; + +class DatabaseVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessment, DatabaseVulnerabilityAssessment.Definition, DatabaseVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + DatabaseVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseVulnerabilityAssessmentImpl(DatabaseVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + 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 name() { + return this.inner().name(); + } + + @Override + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..ca0d10de1ccc2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java @@ -0,0 +1,131 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the vulnerability assessment storage + * account. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the vulnerability assessment storage account. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the vulnerability assessment storage account. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..a2f3fef0d0a6e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,120 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentPolicyBaselineName; + +class DatabaseVulnerabilityAssessmentRuleBaselineImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessmentRuleBaseline, DatabaseVulnerabilityAssessmentRuleBaseline.Definition, DatabaseVulnerabilityAssessmentRuleBaseline.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private String ruleId; + private VulnerabilityAssessmentPolicyBaselineName baselineName; + private List cbaselineResults; + private List ubaselineResults; + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentRuleBaselineInner()); + this.manager = manager; + // Set resource name + this.baselineName = name; + // + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(DatabaseVulnerabilityAssessmentRuleBaselineInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.baselineName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.ruleId = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + this.baselineName = IdParsingUtils.getValueFromIdByName(inner.id(), "baselines"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName, this.cbaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName, this.ubaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List baselineResults() { + return this.inner().baselineResults(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withExistingRule(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + this.ruleId = ruleId; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withBaselineResults(List baselineResults) { + if (isInCreateMode()) { + this.cbaselineResults = baselineResults; + } else { + this.ubaselineResults = baselineResults; + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..4edbff7ffbafc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java @@ -0,0 +1,48 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment rule baseline. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /** + * The rule baseline result. + */ + @JsonProperty(value = "properties.baselineResults", required = true) + private List baselineResults; + + /** + * Get the rule baseline result. + * + * @return the baselineResults value + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the rule baseline result. + * + * @param baselineResults the baselineResults value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults(List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java index 600bda466a785..085c9d4b32120 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java @@ -13,7 +13,7 @@ import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVulnerabilityAssessmentScanRecord; import com.microsoft.azure.Page; import rx.Completable; import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; @@ -30,8 +30,8 @@ public SqlManager manager() { return this.manager; } - private VulnerabilityAssessmentScanRecordImpl wrapVulnerabilityAssessmentScanRecordModel(VulnerabilityAssessmentScanRecordInner inner) { - return new VulnerabilityAssessmentScanRecordImpl(inner, manager()); + private ServerVulnerabilityAssessmentScanRecordImpl wrapServerVulnerabilityAssessmentScanRecordModel(VulnerabilityAssessmentScanRecordInner inner) { + return new ServerVulnerabilityAssessmentScanRecordImpl(inner, manager()); } private Observable getVulnerabilityAssessmentScanRecordInnerUsingDatabaseVulnerabilityAssessmentScansInnerAsync(String id) { @@ -44,19 +44,19 @@ private Observable getVulnerabilityAsses } @Override - public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { DatabaseVulnerabilityAssessmentScansInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, databaseName, scanId) - .map(new Func1() { + .map(new Func1() { @Override - public VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { - return wrapVulnerabilityAssessmentScanRecordModel(inner); + public ServerVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapServerVulnerabilityAssessmentScanRecordModel(inner); } }); } @Override - public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { DatabaseVulnerabilityAssessmentScansInner client = this.inner(); return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) .flatMapIterable(new Func1, Iterable>() { @@ -65,10 +65,10 @@ public Iterable call(Page() { + .map(new Func1() { @Override - public VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { - return wrapVulnerabilityAssessmentScanRecordModel(inner); + public ServerVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapServerVulnerabilityAssessmentScanRecordModel(inner); } }); } diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..446f18dc0e306 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,72 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaseline; +import rx.Completable; + +class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessmentRuleBaselines()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl defineBaseline(String name) { + return wrapBaselineModel(name); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapBaselineModel(String name) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentRuleBaselineInnerUsingManagedDatabaseVulnerabilityAssessmentRuleBaselinesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String ruleId = IdParsingUtils.getValueFromIdByName(id, "rules"); + String baselineName = IdParsingUtils.getValueFromIdByName(id, "baselines"); + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaseline call(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java new file mode 100644 index 0000000000000..96c9069ddde89 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java @@ -0,0 +1,408 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentPolicyBaselineName; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ +public class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessmentRuleBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner get(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults).toBlocking().single().body(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults), serviceCallback); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 (baselineResults == null) { + throw new IllegalArgumentException("Parameter baselineResults is required and cannot be null."); + } + Validator.validate(baselineResults); + final String vulnerabilityAssessmentName = "default"; + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + parameters.withBaselineResults(baselineResults); + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 = 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..161455d1fb421 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVulnerabilityAssessmentScanRecord; + +class ManagedDatabaseVulnerabilityAssessmentScansImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessmentScans { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentScansImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessmentScans()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ManagedInstanceVulnerabilityAssessmentScanRecordImpl wrapModel(VulnerabilityAssessmentScanRecordInner inner) { + return new ManagedInstanceVulnerabilityAssessmentScanRecordImpl(inner, manager()); + } + + @Override + public Completable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.initiateScanAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toCompletable(); + } + + @Override + public Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.exportAsync(resourceGroupName, managedInstanceName, databaseName, scanId) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentScansExport call(DatabaseVulnerabilityAssessmentScansExportInner inner) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseVulnerabilityAssessmentScansInner 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 ManagedInstanceVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, scanId) + .map(new Func1() { + @Override + public ManagedInstanceVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java new file mode 100644 index 0000000000000..37e2c24ebd007 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java @@ -0,0 +1,717 @@ +/** + * 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.v2017_10_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 okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 ManagedDatabaseVulnerabilityAssessmentScans. + */ +public class ManagedDatabaseVulnerabilityAssessmentScansInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentScansService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentScansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentScansService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessmentScans to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans initiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> initiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans beginInitiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> beginInitiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of 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 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); + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.listByDatabase(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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 vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 VulnerabilityAssessmentScanRecordInner object if successful. + */ + public VulnerabilityAssessmentScanRecordInner get(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, VulnerabilityAssessmentScanRecordInner>() { + @Override + public VulnerabilityAssessmentScanRecordInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().last().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> initiateScanWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + Observable> observable = service.initiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginInitiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginInitiateScanWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.beginInitiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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 = beginInitiateScanDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginInitiateScanDelegate(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); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 DatabaseVulnerabilityAssessmentScansExportInner object if successful. + */ + public DatabaseVulnerabilityAssessmentScansExportInner export(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, DatabaseVulnerabilityAssessmentScansExportInner>() { + @Override + public DatabaseVulnerabilityAssessmentScansExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.export(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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 = exportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDelegate(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); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..2aebef01be627 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessment; +import rx.Completable; + +class ManagedDatabaseVulnerabilityAssessmentsImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessments { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl defineVulnerabilityAssessment(String name) { + return wrapVulnerabilityAssessmentModel(name); + } + + private DatabaseVulnerabilityAssessmentImpl wrapVulnerabilityAssessmentModel(String name) { + return new DatabaseVulnerabilityAssessmentImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentImpl wrapDatabaseVulnerabilityAssessmentModel(DatabaseVulnerabilityAssessmentInner inner) { + return new DatabaseVulnerabilityAssessmentImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentInnerUsingManagedDatabaseVulnerabilityAssessmentsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapDatabaseVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..cb03c78870d60 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java @@ -0,0 +1,362 @@ +/** + * 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.v2017_10_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseVulnerabilityAssessments. + */ +public class ManagedDatabaseVulnerabilityAssessmentsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body DatabaseVulnerabilityAssessmentInner 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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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 database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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, DatabaseVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String managedInstanceName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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(); + } + }); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..728910e627ba2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; + +class ManagedInstanceVulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements ManagedInstanceVulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private String scanId; + + ManagedInstanceVulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..b33fd50cc4c1b --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; + +class ServerVulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements ServerVulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String scanId; + + ServerVulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().databaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java index 296cf77e06882..0ea31b9c9e0e8 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java @@ -171,6 +171,45 @@ public DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessment return this.databaseVulnerabilityAssessmentScans; } + /** + * The ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner managedDatabaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner managedDatabaseVulnerabilityAssessmentRuleBaselines() { + return this.managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * The ManagedDatabaseVulnerabilityAssessmentScansInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentScansInner managedDatabaseVulnerabilityAssessmentScans; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentScansInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentScansInner managedDatabaseVulnerabilityAssessmentScans() { + return this.managedDatabaseVulnerabilityAssessmentScans; + } + + /** + * The ManagedDatabaseVulnerabilityAssessmentsInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentsInner managedDatabaseVulnerabilityAssessments; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentsInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentsInner managedDatabaseVulnerabilityAssessments() { + return this.managedDatabaseVulnerabilityAssessments; + } + /** * The CapabilitiesInner object to access its operations. */ @@ -326,6 +365,9 @@ protected void initialize() { this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); this.databases = new DatabasesInner(restClient().retrofit(), this); this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java index 6677354b17e33..f76a2962112b5 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java @@ -19,6 +19,9 @@ import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations; import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations; import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments; import com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities; import com.microsoft.azure.management.sql.v2017_10_01_preview.Databases; import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPools; @@ -38,6 +41,9 @@ public final class SqlManager extends ManagerCore Date: Wed, 31 Oct 2018 13:44:32 -0700 Subject: [PATCH 06/17] Generated from b77f5d1a2652b84a016c368bff34ec26940facac (#2552) Update DatabaseVulnerabilityAssessmentListByDatabase.json --- .../DatabaseVulnerabilityAssessment.java | 38 ++- ...nagedDatabaseVulnerabilityAssessments.java | 12 + .../DatabaseVulnerabilityAssessmentImpl.java | 12 +- .../DatabaseVulnerabilityAssessmentInner.java | 17 +- ...dDatabaseVulnerabilityAssessmentsImpl.java | 19 ++ ...DatabaseVulnerabilityAssessmentsInner.java | 256 ++++++++++++++++++ 6 files changed, 326 insertions(+), 28 deletions(-) diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java index 82e299cd0b656..99f5c0fc35596 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java @@ -60,7 +60,7 @@ public interface DatabaseVulnerabilityAssessment extends HasInner, DefinitionStages.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerSasKey { + interface WithCreate extends Creatable, DefinitionStages.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithStorageContainerSasKey { } } /** * The template for a DatabaseVulnerabilityAssessment update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerSasKey { + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerPath, UpdateStages.WithStorageContainerSasKey { } /** @@ -161,6 +161,16 @@ interface WithStorageAccountAccessKey { Update withStorageAccountAccessKey(String storageAccountAccessKey); } + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + Update withStorageContainerPath(String storageContainerPath); + } + /** * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerSasKey. */ diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java index a968416a939b3..35276f5bcae88 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java @@ -9,6 +9,7 @@ package com.microsoft.azure.management.sql.v2017_10_01_preview; import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessment; import rx.Completable; /** @@ -33,6 +34,17 @@ public interface ManagedDatabaseVulnerabilityAssessments { */ Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment is defined. + * @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); + /** * Removes the database's vulnerability assessment. * diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java index 809982bc6711a..a8c311ee04fd6 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -113,12 +113,6 @@ public DatabaseVulnerabilityAssessmentImpl withExistingDatabasis(String resource return this; } - @Override - public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { - this.inner().withStorageContainerPath(storageContainerPath); - return this; - } - @Override public DatabaseVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { this.inner().withRecurringScans(recurringScans); @@ -131,6 +125,12 @@ public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String st return this; } + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + @Override public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { this.inner().withStorageContainerSasKey(storageContainerSasKey); diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java index ca0d10de1ccc2..fecaa4caac857 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java @@ -20,9 +20,10 @@ public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { /** * A blob storage container path to hold the scan results (e.g. - * https://myStorage.blob.core.windows.net/VaScans/). + * https://myStorage.blob.core.windows.net/VaScans/). It is required if + * server level vulnerability assessment policy doesn't set. */ - @JsonProperty(value = "properties.storageContainerPath", required = true) + @JsonProperty(value = "properties.storageContainerPath") private String storageContainerPath; /** @@ -35,8 +36,8 @@ public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { private String storageContainerSasKey; /** - * Specifies the identifier key of the vulnerability assessment storage - * account. If 'StorageContainerSasKey' isn't specified, + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, * storageAccountAccessKey is required. */ @JsonProperty(value = "properties.storageAccountAccessKey") @@ -49,7 +50,7 @@ public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { private VulnerabilityAssessmentRecurringScansProperties recurringScans; /** - * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. * * @return the storageContainerPath value */ @@ -58,7 +59,7 @@ public String storageContainerPath() { } /** - * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. * * @param storageContainerPath the storageContainerPath value to set * @return the DatabaseVulnerabilityAssessmentInner object itself. @@ -89,7 +90,7 @@ public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String st } /** - * Get specifies the identifier key of the vulnerability assessment storage account. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. * * @return the storageAccountAccessKey value */ @@ -98,7 +99,7 @@ public String storageAccountAccessKey() { } /** - * Set specifies the identifier key of the vulnerability assessment storage account. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. * * @param storageAccountAccessKey the storageAccountAccessKey value to set * @return the DatabaseVulnerabilityAssessmentInner object itself. diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java index 2aebef01be627..601d891194640 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java @@ -14,6 +14,7 @@ import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessment; +import com.microsoft.azure.Page; import rx.Completable; class ManagedDatabaseVulnerabilityAssessmentsImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessments { @@ -61,6 +62,24 @@ public DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner }); } + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner 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 DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapDatabaseVulnerabilityAssessmentModel(inner); + } + }); + } + @Override public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java index cb03c78870d60..26a44afc9a785 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java @@ -10,12 +10,17 @@ 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; @@ -25,6 +30,7 @@ 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; @@ -67,6 +73,14 @@ interface ManagedDatabaseVulnerabilityAssessmentsService { @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments") + 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.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -359,4 +373,246 @@ private ServiceResponse deleteDelegate(Response response) th .build(response); } + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment 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<DatabaseVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment 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 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); + } + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessments of 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 managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseVulnerabilityAssessmentInner> 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); + } + + /** + * Lists the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessments of 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 the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> 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); + } + } From 8b4059446dd6c3739263a7b81e8dddea002e0525 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 6 Nov 2018 15:32:37 -0800 Subject: [PATCH 07/17] Generated from 63e4176e8577c1abaf1a1496628dc432c7fa5479 (#2562) Update Vulnerability Assessment swaggers Update Vulnerability Assessment swaggers --- ...baseVulnerabilityAssessmentScansInner.java | 272 +++++++++--------- 1 file changed, 136 insertions(+), 136 deletions(-) diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java index e847f2a52385a..7eb9bc4dffd5c 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java @@ -58,6 +58,10 @@ public DatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagemen * used by Retrofit to perform actually REST calls. */ interface DatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans get" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -70,10 +74,6 @@ interface DatabaseVulnerabilityAssessmentScansService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") Observable> beginInitiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans listByDatabase" }) - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") - Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans export" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -84,6 +84,138 @@ interface DatabaseVulnerabilityAssessmentScansService { } + /** + * Lists the vulnerability assessment scans of 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. + * @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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of 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. + * @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); + } + + /** + * Lists the vulnerability assessment scans of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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 vulnerability assessment scan record of a database. * @@ -369,138 +501,6 @@ private ServiceResponse beginInitiateScanDelegate(Response r .build(response); } - /** - * Lists the vulnerability assessment scans of 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. - * @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<VulnerabilityAssessmentScanRecordInner> 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(); - } - }; - } - - /** - * Lists the vulnerability assessment scans of 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. - * @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); - } - - /** - * Lists the vulnerability assessment scans of 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. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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(); - } - }); - } - - /** - * Lists the vulnerability assessment scans of 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. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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)); - } - }); - } - - /** - * Lists the vulnerability assessment scans of a 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 serverName The name of the server. - ServiceResponse> * @param databaseName The name of the database. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<VulnerabilityAssessmentScanRecordInner> 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."); - } - final String vulnerabilityAssessmentName = "default"; - return service.listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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); - } - /** * Convert an existing scan result to a human readable format. If already exists nothing happens. * From 21d61150feb11759e9e24c39968f8970c31c76d8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 12 Dec 2018 16:02:09 -0800 Subject: [PATCH 08/17] [AutoPR sql/resource-manager] Reorganized sql readme.md and extracted Java section to a separate file. (#2768) * Generated from 7adce01dbe772579a16371971ca9892566d4dfd2 Reorganized sql readme.md and extracted Java section to a separate file. * Generated from 4b4b9ee6f8a50b350e514e7c2b53aee2bc824423 Removed DataWarehouseUserActivities file from tag package-pure-2017-03-preview * Generated from fc25ee2f82c77a0ced4fdcae9b070b67ac67fb8e Fixed autorest error on model generation * Manual fix of the generation errors. * Generated from fc25ee2f82c77a0ced4fdcae9b070b67ac67fb8e Fixed autorest error on model generation --- .../sql/v2014_04_01/AdvisorListResult.java | 27 + .../sql/v2014_04_01/AdvisorStatus.java | 59 + .../sql/v2014_04_01/AutoExecuteStatus.java | 56 + .../BackupLongTermRetentionPolicies.java | 42 + .../BackupLongTermRetentionPolicy.java | 120 + .../BackupLongTermRetentionPolicyState.java | 53 + .../BackupLongTermRetentionVault.java | 115 + .../BackupLongTermRetentionVaults.java | 40 + .../sql/v2014_04_01/Capabilities.java | 26 + .../sql/v2014_04_01/CapabilityStatus.java | 59 + .../sql/v2014_04_01/DataMaskingFunction.java | 65 + .../sql/v2014_04_01/DataMaskingPolicies.java | 31 + .../sql/v2014_04_01/DataMaskingPolicy.java | 145 + .../sql/v2014_04_01/DataMaskingRule.java | 334 +++ .../sql/v2014_04_01/DataMaskingRuleState.java | 53 + .../sql/v2014_04_01/DataMaskingRules.java | 31 + .../sql/v2014_04_01/DataMaskingState.java | 53 + .../sql/v2014_04_01/DatabaseAdvisors.java | 43 + .../DatabaseConnectionPolicies.java | 31 + .../v2014_04_01/DatabaseConnectionPolicy.java | 270 ++ .../DatabaseTableAuditingPolicies.java | 42 + .../DatabaseTableAuditingPolicy.java | 396 +++ ...DatabaseTableAuditingPolicyListResult.java | 27 + .../sql/v2014_04_01/DatabaseUsage.java | 56 + .../sql/v2014_04_01/DatabaseUsages.java | 30 + .../management/sql/v2014_04_01/Databases.java | 25 + .../v2014_04_01/DatabasisServerAdvisor.java | 136 + .../v2014_04_01/DatabasisServerMetric.java | 52 + .../DatabasisServerMetricDefinition.java | 46 + .../DisasterRecoveryConfiguration.java | 75 + ...sterRecoveryConfigurationAutoFailover.java | 41 + ...erRecoveryConfigurationFailoverPolicy.java | 41 + .../DisasterRecoveryConfigurationRole.java | 44 + .../DisasterRecoveryConfigurationStatus.java | 47 + .../DisasterRecoveryConfigurations.java | 85 + .../sql/v2014_04_01/EditionCapability.java | 79 + .../v2014_04_01/ElasticPoolDtuCapability.java | 124 + .../ElasticPoolEditionCapability.java | 79 + ...lasticPoolPerDatabaseMaxDtuCapability.java | 64 + ...lasticPoolPerDatabaseMinDtuCapability.java | 48 + .../v2014_04_01/ElasticPoolServerMetric.java | 52 + .../ElasticPoolServerMetricDefinition.java | 46 + .../sql/v2014_04_01/ElasticPools.java | 25 + .../sql/v2014_04_01/Extensions.java | 30 + .../sql/v2014_04_01/GeoBackupPolicies.java | 42 + .../sql/v2014_04_01/GeoBackupPolicy.java | 125 + .../sql/v2014_04_01/GeoBackupPolicyState.java | 53 + .../sql/v2014_04_01/LocationCapabilities.java | 36 + .../sql/v2014_04_01/MaxSizeCapability.java | 64 + .../sql/v2014_04_01/MaxSizeUnits.java | 59 + .../sql/v2014_04_01/MetricAvailability.java | 47 + .../sql/v2014_04_01/MetricName.java | 47 + .../sql/v2014_04_01/MetricValue.java | 108 + .../sql/v2014_04_01/OperationDisplay.java | 95 + .../sql/v2014_04_01/OperationListResult.java | 32 + .../sql/v2014_04_01/Operations.java | 27 + .../sql/v2014_04_01/PerformanceLevelUnit.java | 50 + .../v2014_04_01/PrimaryAggregationType.java | 53 + .../management/sql/v2014_04_01/Queries.java | 30 + .../v2014_04_01/QueryAggregationFunction.java | 59 + .../sql/v2014_04_01/QueryExecutionType.java | 62 + .../sql/v2014_04_01/QueryInterval.java | 64 + .../sql/v2014_04_01/QueryMetric.java | 78 + .../sql/v2014_04_01/QueryMetricUnit.java | 56 + .../v2014_04_01/QueryObservedMetricType.java | 62 + .../sql/v2014_04_01/QueryStatistic.java | 31 + .../sql/v2014_04_01/QueryStatistics.java | 31 + .../management/sql/v2014_04_01/QueryText.java | 35 + .../sql/v2014_04_01/QueryTexts.java | 31 + .../sql/v2014_04_01/RecoverableDatabase.java | 58 + .../sql/v2014_04_01/RecoverableDatabases.java | 40 + .../RestorableDroppedDatabase.java | 83 + .../RestorableDroppedDatabases.java | 40 + .../sql/v2014_04_01/RestorePoint.java | 51 + .../sql/v2014_04_01/RestorePointType.java | 53 + .../sql/v2014_04_01/RestorePoints.java | 30 + .../management/sql/v2014_04_01/Server.java | 169 ++ .../sql/v2014_04_01/ServerAdvisor.java | 136 + .../sql/v2014_04_01/ServerAdvisors.java | 41 + .../ServerAzureADAdministrator.java | 146 + .../ServerAzureADAdministrators.java | 51 + .../v2014_04_01/ServerCommunicationLink.java | 125 + .../v2014_04_01/ServerCommunicationLinks.java | 53 + .../v2014_04_01/ServerConnectionPolicies.java | 30 + .../v2014_04_01/ServerConnectionPolicy.java | 120 + .../sql/v2014_04_01/ServerConnectionType.java | 56 + .../sql/v2014_04_01/ServerState.java | 53 + .../ServerTableAuditingPolicies.java | 40 + .../ServerTableAuditingPolicy.java | 371 +++ .../ServerTableAuditingPolicyListResult.java | 27 + .../sql/v2014_04_01/ServerUpdate.java | 191 ++ .../sql/v2014_04_01/ServerUsage.java | 56 + .../sql/v2014_04_01/ServerUsages.java | 29 + .../sql/v2014_04_01/ServerVersion.java | 41 + .../v2014_04_01/ServerVersionCapability.java | 79 + .../management/sql/v2014_04_01/Servers.java | 8 +- .../sql/v2014_04_01/ServiceObjective.java | 62 + .../ServiceObjectiveCapability.java | 128 + .../sql/v2014_04_01/ServiceObjectives.java | 40 + .../TableAuditingPolicyProperties.java | 304 +++ .../sql/v2014_04_01/TopQueries.java | 62 + ...ansparentDataEncryptionConfigurations.java | 30 + .../sql/v2014_04_01/UnitDefinitionType.java | 53 + .../management/sql/v2014_04_01/UnitType.java | 53 + .../implementation/AdvisorInner.java | 133 + .../implementation/AdvisorListResultImpl.java | 32 + .../AdvisorListResultInner.java | 44 + .../BackupLongTermRetentionPoliciesImpl.java | 74 + .../BackupLongTermRetentionPoliciesInner.java | 457 ++++ .../BackupLongTermRetentionPolicyImpl.java | 123 + .../BackupLongTermRetentionPolicyInner.java | 89 + .../BackupLongTermRetentionVaultImpl.java | 114 + .../BackupLongTermRetentionVaultInner.java | 61 + .../BackupLongTermRetentionVaultsImpl.java | 74 + .../BackupLongTermRetentionVaultsInner.java | 430 +++ .../implementation/CapabilitiesImpl.java | 42 + .../implementation/CapabilitiesInner.java | 139 + .../DataMaskingPoliciesImpl.java | 55 + .../DataMaskingPoliciesInner.java | 263 ++ .../implementation/DataMaskingPolicyImpl.java | 138 + .../DataMaskingPolicyInner.java | 138 + .../implementation/DataMaskingRuleImpl.java | 235 ++ .../implementation/DataMaskingRuleInner.java | 367 +++ .../implementation/DataMaskingRulesImpl.java | 62 + .../implementation/DataMaskingRulesInner.java | 277 ++ .../implementation/DatabaseAdvisorsImpl.java | 68 + .../implementation/DatabaseAdvisorsInner.java | 373 +++ .../DatabaseConnectionPoliciesImpl.java | 55 + .../DatabaseConnectionPoliciesInner.java | 264 ++ .../DatabaseConnectionPolicyImpl.java | 182 ++ .../DatabaseConnectionPolicyInner.java | 232 ++ .../DatabaseTableAuditingPoliciesImpl.java | 68 + .../DatabaseTableAuditingPoliciesInner.java | 361 +++ .../DatabaseTableAuditingPolicyImpl.java | 238 ++ .../DatabaseTableAuditingPolicyInner.java | 363 +++ ...baseTableAuditingPolicyListResultImpl.java | 32 + ...aseTableAuditingPolicyListResultInner.java | 44 + .../implementation/DatabaseUsageImpl.java | 66 + .../implementation/DatabaseUsageInner.java | 123 + .../implementation/DatabaseUsagesImpl.java | 53 + .../implementation/DatabaseUsagesInner.java | 159 ++ .../implementation/DatabasesImpl.java | 46 + .../implementation/DatabasesInner.java | 211 ++ .../DatabasisServerAdvisorImpl.java | 142 + .../DatabasisServerMetricDefinitionImpl.java | 60 + .../DatabasisServerMetricImpl.java | 65 + .../DisasterRecoveryConfigurationImpl.java | 85 + .../DisasterRecoveryConfigurationInner.java | 182 ++ .../DisasterRecoveryConfigurationsImpl.java | 92 + .../DisasterRecoveryConfigurationsInner.java | 960 +++++++ ...ElasticPoolServerMetricDefinitionImpl.java | 60 + .../ElasticPoolServerMetricImpl.java | 65 + .../implementation/ElasticPoolsImpl.java | 46 + .../implementation/ElasticPoolsInner.java | 211 ++ .../implementation/ExtensionsImpl.java | 37 + .../implementation/ExtensionsInner.java | 159 ++ .../implementation/GeoBackupPoliciesImpl.java | 74 + .../GeoBackupPoliciesInner.java | 368 +++ .../implementation/GeoBackupPolicyImpl.java | 128 + .../implementation/GeoBackupPolicyInner.java | 94 + .../LocationCapabilitiesImpl.java | 44 + .../LocationCapabilitiesInner.java | 66 + .../implementation/MetricDefinitionInner.java | 100 + .../implementation/MetricInner.java | 113 + .../implementation/OperationInner.java | 70 + .../OperationListResultImpl.java | 37 + .../OperationListResultInner.java | 71 + .../implementation/OperationsImpl.java | 42 + .../implementation/OperationsInner.java | 128 + .../implementation/QueriesImpl.java | 53 + .../implementation/QueriesInner.java | 159 ++ .../implementation/QueryStatisticImpl.java | 42 + .../implementation/QueryStatisticInner.java | 49 + .../implementation/QueryStatisticsImpl.java | 53 + .../implementation/QueryStatisticsInner.java | 166 ++ .../implementation/QueryTextImpl.java | 41 + .../implementation/QueryTextInner.java | 62 + .../implementation/QueryTextsImpl.java | 49 + .../implementation/QueryTextsInner.java | 166 ++ .../RecoverableDatabaseImpl.java | 78 + .../RecoverableDatabaseInner.java | 81 + .../RecoverableDatabasesImpl.java | 65 + .../RecoverableDatabasesInner.java | 249 ++ .../RestorableDroppedDatabaseImpl.java | 103 + .../RestorableDroppedDatabaseInner.java | 156 ++ .../RestorableDroppedDatabasesImpl.java | 65 + .../RestorableDroppedDatabasesInner.java | 249 ++ .../implementation/RestorePointImpl.java | 62 + .../implementation/RestorePointInner.java | 70 + .../implementation/RestorePointsImpl.java | 53 + .../implementation/RestorePointsInner.java | 159 ++ .../implementation/ServerAdvisorImpl.java | 139 + .../implementation/ServerAdvisorsImpl.java | 68 + .../implementation/ServerAdvisorsInner.java | 459 ++++ .../ServerAzureADAdministratorImpl.java | 137 + .../ServerAzureADAdministratorInner.java | 135 + .../ServerAzureADAdministratorsImpl.java | 81 + .../ServerAzureADAdministratorsInner.java | 598 +++++ .../ServerCommunicationLinkImpl.java | 126 + .../ServerCommunicationLinkInner.java | 92 + .../ServerCommunicationLinksImpl.java | 81 + .../ServerCommunicationLinksInner.java | 544 ++++ .../ServerConnectionPoliciesImpl.java | 55 + .../ServerConnectionPoliciesInner.java | 251 ++ .../ServerConnectionPolicyImpl.java | 120 + .../ServerConnectionPolicyInner.java | 78 + .../implementation/ServerImpl.java | 140 + .../implementation/ServerInner.java | 182 ++ .../ServerTableAuditingPoliciesImpl.java | 68 + .../ServerTableAuditingPoliciesInner.java | 340 +++ .../ServerTableAuditingPolicyImpl.java | 224 ++ .../ServerTableAuditingPolicyInner.java | 337 +++ ...rverTableAuditingPolicyListResultImpl.java | 32 + ...verTableAuditingPolicyListResultInner.java | 44 + .../implementation/ServerUsageImpl.java | 66 + .../implementation/ServerUsageInner.java | 123 + .../implementation/ServerUsagesImpl.java | 53 + .../implementation/ServerUsagesInner.java | 152 ++ .../implementation/ServersImpl.java | 129 +- .../implementation/ServersInner.java | 568 +++- .../implementation/ServiceObjectiveImpl.java | 82 + .../implementation/ServiceObjectiveInner.java | 96 + .../implementation/ServiceObjectivesImpl.java | 65 + .../ServiceObjectivesInner.java | 249 ++ .../SqlManagementClientImpl.java | 416 ++- .../implementation/SqlManager.java | 338 ++- .../implementation/TopQueriesImpl.java | 83 + .../implementation/TopQueriesInner.java | 146 + ...arentDataEncryptionConfigurationsImpl.java | 49 + ...rentDataEncryptionConfigurationsInner.java | 159 ++ .../v2015_05_01_preview/pom.xml | 133 + .../v2015_05_01_preview/AdvisorStatus.java | 59 + .../AutoExecuteStatus.java | 56 + .../AutoExecuteStatusInheritedFrom.java | 62 + .../AutomaticTuningDisabledReason.java | 68 + .../AutomaticTuningMode.java | 59 + .../AutomaticTuningOptionModeActual.java | 53 + .../AutomaticTuningOptionModeDesired.java | 56 + .../AutomaticTuningOptions.java | 93 + .../BlobAuditingPolicyState.java | 53 + .../v2015_05_01_preview/DatabaseAdvisors.java | 42 + .../DatabaseAutomaticTuning.java | 51 + .../DatabaseAutomaticTunings.java | 43 + .../DatabaseBlobAuditingPolicies.java | 31 + .../DatabaseBlobAuditingPolicy.java | 282 ++ .../DatabaseRecommendedActions.java | 44 + .../DatabasisServerAdvisor.java | 102 + .../EncryptionProtector.java | 70 + .../EncryptionProtectors.java | 51 + .../v2015_05_01_preview/FailoverGroup.java | 217 ++ .../FailoverGroupReadOnlyEndpoint.java | 44 + .../FailoverGroupReadWriteEndpoint.java | 73 + .../FailoverGroupReplicationRole.java | 41 + .../FailoverGroupUpdate.java | 125 + .../v2015_05_01_preview/FailoverGroups.java | 75 + .../sql/v2015_05_01_preview/FirewallRule.java | 135 + .../v2015_05_01_preview/FirewallRuleList.java | 45 + .../v2015_05_01_preview/FirewallRules.java | 63 + .../sql/v2015_05_01_preview/IdentityType.java | 38 + .../ImplementationMethod.java | 53 + .../sql/v2015_05_01_preview/IsRetryable.java | 53 + .../v2015_05_01_preview/ManagedInstance.java | 323 +++ .../ManagedInstanceUpdate.java | 329 +++ .../v2015_05_01_preview/ManagedInstances.java | 25 + .../sql/v2015_05_01_preview/Operation.java | 41 + .../v2015_05_01_preview/OperationDisplay.java | 78 + .../v2015_05_01_preview/OperationOrigin.java | 41 + .../sql/v2015_05_01_preview/Operations.java | 27 + .../sql/v2015_05_01_preview/PartnerInfo.java | 74 + .../ProxyResourceWithWritableName.java | 16 + .../ReadOnlyEndpointFailoverPolicy.java | 41 + .../ReadWriteEndpointFailoverPolicy.java | 41 + .../RecommendedAction.java | 188 ++ .../RecommendedActionCurrentState.java | 77 + .../RecommendedActionErrorInfo.java | 51 + .../RecommendedActionImpactRecord.java | 98 + .../RecommendedActionImplementationInfo.java | 51 + .../RecommendedActionInitiatedBy.java | 53 + .../RecommendedActionMetricInfo.java | 96 + .../RecommendedActionStateInfo.java | 95 + .../v2015_05_01_preview/ResourceIdentity.java | 76 + .../ResourceWithWritableName.java | 17 + .../sql/v2015_05_01_preview/Server.java | 173 ++ .../v2015_05_01_preview/ServerAdvisor.java | 102 + .../v2015_05_01_preview/ServerAdvisors.java | 40 + .../sql/v2015_05_01_preview/ServerKey.java | 211 ++ .../v2015_05_01_preview/ServerKeyType.java | 41 + .../sql/v2015_05_01_preview/ServerKeys.java | 53 + .../sql/v2015_05_01_preview/ServerUpdate.java | 155 ++ .../sql/v2015_05_01_preview/Servers.java | 25 + .../sql/v2015_05_01_preview/Sku.java | 152 ++ .../SubscriptionUsage.java | 57 + .../SubscriptionUsages.java | 37 + .../sql/v2015_05_01_preview/SyncAgent.java | 121 + .../SyncAgentKeyProperties.java | 25 + .../SyncAgentLinkedDatabase.java | 65 + .../v2015_05_01_preview/SyncAgentState.java | 44 + .../sql/v2015_05_01_preview/SyncAgents.java | 76 + .../SyncConflictResolutionPolicy.java | 41 + .../SyncDatabaseIdProperties.java | 25 + .../v2015_05_01_preview/SyncDirection.java | 44 + .../SyncFullSchemaTable.java | 93 + .../SyncFullSchemaTableColumn.java | 122 + .../sql/v2015_05_01_preview/SyncGroup.java | 246 ++ ...tabasisServerSyncFullSchemaProperties.java | 32 + .../SyncGroupLogProperties.java | 52 + .../v2015_05_01_preview/SyncGroupLogType.java | 47 + .../v2015_05_01_preview/SyncGroupSchema.java | 70 + .../SyncGroupSchemaTable.java | 70 + .../SyncGroupSchemaTableColumn.java | 95 + .../v2015_05_01_preview/SyncGroupState.java | 50 + .../sql/v2015_05_01_preview/SyncGroups.java | 131 + .../sql/v2015_05_01_preview/SyncMember.java | 291 ++ .../v2015_05_01_preview/SyncMemberDbType.java | 41 + .../v2015_05_01_preview/SyncMemberState.java | 89 + ...tabasisServerSyncFullSchemaProperties.java | 32 + .../sql/v2015_05_01_preview/SyncMembers.java | 86 + .../VirtualNetworkRule.java | 130 + .../VirtualNetworkRuleState.java | 50 + .../VirtualNetworkRules.java | 53 + .../implementation/AdvisorInner.java | 170 ++ .../implementation/DatabaseAdvisorsImpl.java | 65 + .../implementation/DatabaseAdvisorsInner.java | 374 +++ .../DatabaseAutomaticTuningImpl.java | 59 + .../DatabaseAutomaticTuningInner.java | 92 + .../DatabaseAutomaticTuningsImpl.java | 54 + .../DatabaseAutomaticTuningsInner.java | 261 ++ .../DatabaseBlobAuditingPoliciesImpl.java | 55 + .../DatabaseBlobAuditingPoliciesInner.java | 264 ++ .../DatabaseBlobAuditingPolicyImpl.java | 191 ++ .../DatabaseBlobAuditingPolicyInner.java | 443 ++++ .../DatabaseRecommendedActionsImpl.java | 65 + .../DatabaseRecommendedActionsInner.java | 397 +++ .../DatabasisServerAdvisorImpl.java | 148 ++ .../EncryptionProtectorImpl.java | 77 + .../EncryptionProtectorInner.java | 161 ++ .../EncryptionProtectorsImpl.java | 73 + .../EncryptionProtectorsInner.java | 580 ++++ .../implementation/FailoverGroupImpl.java | 208 ++ .../implementation/FailoverGroupInner.java | 202 ++ .../implementation/FailoverGroupsImpl.java | 105 + .../implementation/FailoverGroupsInner.java | 1330 ++++++++++ .../implementation/FirewallRuleImpl.java | 116 + .../implementation/FirewallRuleInner.java | 75 + .../implementation/FirewallRulesImpl.java | 93 + .../implementation/FirewallRulesInner.java | 789 ++++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/ManagedInstanceImpl.java | 230 ++ .../implementation/ManagedInstanceInner.java | 331 +++ .../implementation/ManagedInstancesImpl.java | 138 + .../implementation/ManagedInstancesInner.java | 1145 ++++++++ .../implementation/OperationImpl.java | 49 + .../implementation/OperationInner.java | 82 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../implementation/PageImpl.java | 75 + .../implementation/RecommendedActionImpl.java | 244 ++ .../RecommendedActionInner.java | 429 +++ .../implementation/ServerAdvisorImpl.java | 146 + .../implementation/ServerAdvisorsImpl.java | 65 + .../implementation/ServerAdvisorsInner.java | 353 +++ .../implementation/ServerImpl.java | 139 + .../implementation/ServerInner.java | 172 ++ .../implementation/ServerKeyImpl.java | 161 ++ .../implementation/ServerKeyInner.java | 184 ++ .../implementation/ServerKeysImpl.java | 81 + .../implementation/ServerKeysInner.java | 777 ++++++ .../implementation/ServersImpl.java | 138 + .../implementation/ServersInner.java | 1145 ++++++++ .../SqlManagementClientImpl.java | 420 +++ .../implementation/SqlManager.java | 291 ++ .../implementation/SubscriptionUsageImpl.java | 75 + .../SubscriptionUsageInner.java | 80 + .../SubscriptionUsagesImpl.java | 72 + .../SubscriptionUsagesInner.java | 386 +++ .../implementation/SyncAgentImpl.java | 131 + .../implementation/SyncAgentInner.java | 139 + .../SyncAgentKeyPropertiesImpl.java | 31 + .../SyncAgentKeyPropertiesInner.java | 32 + .../SyncAgentLinkedDatabaseImpl.java | 76 + .../SyncAgentLinkedDatabaseInner.java | 112 + .../implementation/SyncAgentsImpl.java | 117 + .../implementation/SyncAgentsInner.java | 1287 +++++++++ .../SyncDatabaseIdPropertiesImpl.java | 35 + .../SyncDatabaseIdPropertiesInner.java | 32 + .../SyncFullSchemaPropertiesInner.java | 50 + ...sisServerSyncFullSchemaPropertiesImpl.java | 43 + .../implementation/SyncGroupImpl.java | 177 ++ .../implementation/SyncGroupInner.java | 212 ++ .../SyncGroupLogPropertiesImpl.java | 63 + .../SyncGroupLogPropertiesInner.java | 111 + .../implementation/SyncGroupsImpl.java | 168 ++ .../implementation/SyncGroupsInner.java | 2362 +++++++++++++++++ .../implementation/SyncMemberImpl.java | 197 ++ .../implementation/SyncMemberInner.java | 255 ++ ...sisServerSyncFullSchemaPropertiesImpl.java | 43 + .../implementation/SyncMembersImpl.java | 110 + .../implementation/SyncMembersInner.java | 1557 +++++++++++ .../VirtualNetworkRuleImpl.java | 122 + .../VirtualNetworkRuleInner.java | 90 + .../VirtualNetworkRulesImpl.java | 81 + .../VirtualNetworkRulesInner.java | 777 ++++++ .../implementation/package-info.java | 11 + .../sql/v2015_05_01_preview/package-info.java | 11 + .../v2017_03_01_preview/pom.xml | 133 + .../AutomaticTuningOptionModeActual.java | 53 + .../AutomaticTuningOptionModeDesired.java | 56 + .../AutomaticTuningServerMode.java | 56 + .../AutomaticTuningServerOptions.java | 91 + .../AutomaticTuningServerReason.java | 56 + .../BackupLongTermRetentionPolicies.java | 42 + .../BackupLongTermRetentionPolicy.java | 185 ++ .../BlobAuditingPolicyState.java | 53 + .../CatalogCollationType.java | 41 + .../CompleteDatabaseRestoreDefinition.java | 44 + .../CreateDatabaseRestorePointDefinition.java | 44 + .../sql/v2017_03_01_preview/CreateMode.java | 65 + .../DataWarehouseUserActivities.java | 30 + .../DataWarehouseUserActivity.java | 42 + .../sql/v2017_03_01_preview/Database.java | 538 ++++ .../DatabaseBlobAuditingPolicies.java | 31 + .../DatabaseBlobAuditingPolicy.java | 282 ++ .../DatabaseOperation.java | 106 + .../DatabaseOperations.java | 44 + .../v2017_03_01_preview/DatabaseStatus.java | 89 + .../v2017_03_01_preview/DatabaseUpdate.java | 595 +++++ .../DatabaseVulnerabilityAssessment.java | 185 ++ ...seVulnerabilityAssessmentRuleBaseline.java | 111 + ...lnerabilityAssessmentRuleBaselineItem.java | 45 + ...eVulnerabilityAssessmentRuleBaselines.java | 51 + .../DatabaseVulnerabilityAssessments.java | 54 + .../sql/v2017_03_01_preview/Databases.java | 110 + ...xecutionJobJobAgentServerJobExecution.java | 104 + ...ionJobJobAgentServerJobExecutionModel.java | 102 + .../ExtendedDatabaseBlobAuditingPolicies.java | 31 + .../ExtendedDatabaseBlobAuditingPolicy.java | 302 +++ .../ExtendedServerBlobAuditingPolicies.java | 30 + .../ExtendedServerBlobAuditingPolicy.java | 302 +++ .../ImportExportDatabaseDefinition.java | 277 ++ .../ImportExportOperationResult.java | 81 + .../sql/v2017_03_01_preview/Job.java | 140 + .../sql/v2017_03_01_preview/JobAgent.java | 171 ++ .../JobAgentServerJobExecution.java | 151 ++ .../v2017_03_01_preview/JobAgentState.java | 50 + .../v2017_03_01_preview/JobAgentUpdate.java | 44 + .../sql/v2017_03_01_preview/JobAgents.java | 53 + .../v2017_03_01_preview/JobCredential.java | 115 + .../v2017_03_01_preview/JobCredentials.java | 56 + .../JobExecutionLifecycle.java | 65 + .../JobExecutionTarget.java | 63 + .../v2017_03_01_preview/JobExecutions.java | 88 + .../sql/v2017_03_01_preview/JobSchedule.java | 149 ++ .../v2017_03_01_preview/JobScheduleType.java | 53 + .../sql/v2017_03_01_preview/JobStep.java | 204 ++ .../v2017_03_01_preview/JobStepAction.java | 96 + .../JobStepActionSource.java | 38 + .../JobStepActionType.java | 38 + .../JobStepExecutionOptions.java | 149 ++ .../JobStepExecutions.java | 45 + .../v2017_03_01_preview/JobStepOutput.java | 227 ++ .../JobStepOutputType.java | 38 + .../sql/v2017_03_01_preview/JobSteps.java | 86 + .../sql/v2017_03_01_preview/JobTarget.java | 204 ++ .../JobTargetExecutions.java | 61 + .../v2017_03_01_preview/JobTargetGroup.java | 111 + .../JobTargetGroupMembershipType.java | 53 + .../v2017_03_01_preview/JobTargetGroups.java | 56 + .../v2017_03_01_preview/JobTargetType.java | 50 + .../sql/v2017_03_01_preview/JobVersion.java | 37 + .../sql/v2017_03_01_preview/JobVersions.java | 44 + .../sql/v2017_03_01_preview/Jobs.java | 56 + .../LongTermRetentionBackup.java | 68 + .../LongTermRetentionBackups.java | 74 + .../LongTermRetentionDatabaseState.java | 44 + ...nagedBackupShortTermRetentionPolicies.java | 42 + ...ManagedBackupShortTermRetentionPolicy.java | 90 + .../v2017_03_01_preview/ManagedDatabase.java | 327 +++ .../ManagedDatabaseCreateMode.java | 44 + .../ManagedDatabaseStatus.java | 50 + .../ManagedDatabaseUpdate.java | 319 +++ .../v2017_03_01_preview/ManagedDatabases.java | 70 + .../ManagementOperationState.java | 53 + .../ProvisioningState.java | 50 + .../ResourceMoveDefinition.java | 43 + .../sql/v2017_03_01_preview/RestorePoint.java | 63 + .../v2017_03_01_preview/RestorePointType.java | 53 + .../v2017_03_01_preview/RestorePoints.java | 67 + .../sql/v2017_03_01_preview/SampleName.java | 44 + .../SecurityAlertPolicyState.java | 56 + .../ServerAutomaticTuning.java | 51 + .../ServerAutomaticTunings.java | 41 + .../ServerBlobAuditingPolicies.java | 30 + .../ServerBlobAuditingPolicy.java | 277 ++ .../v2017_03_01_preview/ServerDnsAlias.java | 90 + .../ServerDnsAliasAcquisition.java | 44 + .../v2017_03_01_preview/ServerDnsAliases.java | 64 + .../ServerSecurityAlertPolicies.java | 30 + .../ServerSecurityAlertPolicy.java | 251 ++ .../sql/v2017_03_01_preview/Sku.java | 152 ++ ...erabilityAssessmentPolicyBaselineName.java | 53 + ...ityAssessmentRecurringScansProperties.java | 98 + .../BackupLongTermRetentionPoliciesImpl.java | 67 + .../BackupLongTermRetentionPoliciesInner.java | 450 ++++ .../BackupLongTermRetentionPolicyImpl.java | 139 + .../BackupLongTermRetentionPolicyInner.java | 124 + .../DataWarehouseUserActivitiesImpl.java | 46 + .../DataWarehouseUserActivitiesInner.java | 154 ++ .../DataWarehouseUserActivityImpl.java | 62 + .../DataWarehouseUserActivityInner.java | 35 + .../DatabaseBlobAuditingPoliciesImpl.java | 55 + .../DatabaseBlobAuditingPoliciesInner.java | 264 ++ .../DatabaseBlobAuditingPolicyImpl.java | 191 ++ .../DatabaseBlobAuditingPolicyInner.java | 443 ++++ .../implementation/DatabaseImpl.java | 410 +++ .../implementation/DatabaseInner.java | 589 ++++ .../implementation/DatabaseOperationImpl.java | 117 + .../DatabaseOperationInner.java | 233 ++ .../DatabaseOperationsImpl.java | 61 + .../DatabaseOperationsInner.java | 417 +++ .../DatabaseVulnerabilityAssessmentImpl.java | 140 + .../DatabaseVulnerabilityAssessmentInner.java | 132 + ...lnerabilityAssessmentRuleBaselineImpl.java | 120 + ...nerabilityAssessmentRuleBaselineInner.java | 48 + ...nerabilityAssessmentRuleBaselinesImpl.java | 72 + ...erabilityAssessmentRuleBaselinesInner.java | 408 +++ .../DatabaseVulnerabilityAssessmentsImpl.java | 81 + ...DatabaseVulnerabilityAssessmentsInner.java | 618 +++++ .../implementation/DatabasesImpl.java | 143 + .../implementation/DatabasesInner.java | 1881 +++++++++++++ ...tionJobJobAgentServerJobExecutionImpl.java | 133 + ...obJobAgentServerJobExecutionModelImpl.java | 115 + ...endedDatabaseBlobAuditingPoliciesImpl.java | 55 + ...ndedDatabaseBlobAuditingPoliciesInner.java | 264 ++ ...xtendedDatabaseBlobAuditingPolicyImpl.java | 197 ++ ...tendedDatabaseBlobAuditingPolicyInner.java | 454 ++++ ...xtendedServerBlobAuditingPoliciesImpl.java | 55 + ...tendedServerBlobAuditingPoliciesInner.java | 332 +++ .../ExtendedServerBlobAuditingPolicyImpl.java | 194 ++ ...ExtendedServerBlobAuditingPolicyInner.java | 454 ++++ .../implementation/IdParsingUtils.java | 57 + .../ImportExportOperationResultImpl.java | 87 + .../ImportExportOperationResultInner.java | 156 ++ .../implementation/JobAgentImpl.java | 146 + .../implementation/JobAgentInner.java | 90 + .../JobAgentServerJobExecutionImpl.java | 170 ++ .../implementation/JobAgentsImpl.java | 81 + .../implementation/JobAgentsInner.java | 1139 ++++++++ .../implementation/JobCredentialImpl.java | 119 + .../implementation/JobCredentialInner.java | 73 + .../implementation/JobCredentialsImpl.java | 81 + .../implementation/JobCredentialsInner.java | 637 +++++ .../implementation/JobExecutionInner.java | 235 ++ .../implementation/JobExecutionsImpl.java | 112 + .../implementation/JobExecutionsInner.java | 1534 +++++++++++ .../implementation/JobImpl.java | 125 + .../implementation/JobInner.java | 88 + .../implementation/JobStepExecutionsImpl.java | 76 + .../JobStepExecutionsInner.java | 630 +++++ .../implementation/JobStepImpl.java | 169 ++ .../implementation/JobStepInner.java | 183 ++ .../implementation/JobStepsImpl.java | 111 + .../implementation/JobStepsInner.java | 1044 ++++++++ .../JobTargetExecutionsImpl.java | 85 + .../JobTargetExecutionsInner.java | 1101 ++++++++ .../implementation/JobTargetGroupImpl.java | 116 + .../implementation/JobTargetGroupInner.java | 48 + .../implementation/JobTargetGroupsImpl.java | 81 + .../implementation/JobTargetGroupsInner.java | 640 +++++ .../implementation/JobVersionImpl.java | 61 + .../implementation/JobVersionInner.java | 17 + .../implementation/JobVersionsImpl.java | 65 + .../implementation/JobVersionsInner.java | 428 +++ .../implementation/JobsImpl.java | 81 + .../implementation/JobsInner.java | 637 +++++ .../LongTermRetentionBackupImpl.java | 90 + .../LongTermRetentionBackupInner.java | 111 + .../LongTermRetentionBackupsImpl.java | 108 + .../LongTermRetentionBackupsInner.java | 1468 ++++++++++ ...dBackupShortTermRetentionPoliciesImpl.java | 74 + ...BackupShortTermRetentionPoliciesInner.java | 1135 ++++++++ ...gedBackupShortTermRetentionPolicyImpl.java | 100 + ...edBackupShortTermRetentionPolicyInner.java | 47 + .../implementation/ManagedDatabaseImpl.java | 277 ++ .../implementation/ManagedDatabaseInner.java | 296 +++ .../implementation/ManagedDatabasesImpl.java | 96 + .../implementation/ManagedDatabasesInner.java | 1156 ++++++++ .../implementation/PageImpl.java | 75 + .../implementation/PageImpl1.java | 75 + .../implementation/RestorePointImpl.java | 86 + .../implementation/RestorePointInner.java | 98 + .../implementation/RestorePointsImpl.java | 84 + .../implementation/RestorePointsInner.java | 567 ++++ .../ServerAutomaticTuningImpl.java | 59 + .../ServerAutomaticTuningInner.java | 92 + .../ServerAutomaticTuningsImpl.java | 54 + .../ServerAutomaticTuningsInner.java | 247 ++ .../ServerBlobAuditingPoliciesImpl.java | 55 + .../ServerBlobAuditingPoliciesInner.java | 332 +++ .../ServerBlobAuditingPolicyImpl.java | 183 ++ .../ServerBlobAuditingPolicyInner.java | 428 +++ .../implementation/ServerDnsAliasImpl.java | 99 + .../implementation/ServerDnsAliasInner.java | 35 + .../implementation/ServerDnsAliasesImpl.java | 87 + .../implementation/ServerDnsAliasesInner.java | 1115 ++++++++ .../ServerSecurityAlertPoliciesImpl.java | 55 + .../ServerSecurityAlertPoliciesInner.java | 332 +++ .../ServerSecurityAlertPolicyImpl.java | 171 ++ .../ServerSecurityAlertPolicyInner.java | 210 ++ .../SqlManagementClientImpl.java | 546 ++++ .../implementation/SqlManager.java | 399 +++ .../implementation/package-info.java | 11 + .../sql/v2017_03_01_preview/package-info.java | 11 + .../v2018_06_01_preview/pom.xml | 133 + ...anagedInstanceVulnerabilityAssessment.java | 175 ++ ...nagedInstanceVulnerabilityAssessments.java | 56 + .../ServerVulnerabilityAssessment.java | 175 ++ .../ServerVulnerabilityAssessments.java | 56 + ...ityAssessmentRecurringScansProperties.java | 98 + .../implementation/IdParsingUtils.java | 57 + ...edInstanceVulnerabilityAssessmentImpl.java | 137 + ...dInstanceVulnerabilityAssessmentInner.java | 131 + ...dInstanceVulnerabilityAssessmentsImpl.java | 88 + ...InstanceVulnerabilityAssessmentsInner.java | 590 ++++ .../implementation/PageImpl.java | 75 + .../ServerVulnerabilityAssessmentImpl.java | 137 + .../ServerVulnerabilityAssessmentInner.java | 131 + .../ServerVulnerabilityAssessmentsImpl.java | 88 + .../ServerVulnerabilityAssessmentsInner.java | 590 ++++ .../SqlManagementClientImpl.java | 210 ++ .../implementation/SqlManager.java | 111 + .../implementation/package-info.java | 11 + .../sql/v2018_06_01_preview/package-info.java | 11 + sql/resource-manager/v3_2014_04/pom.xml | 133 + .../sql/v3_2014_04/AuthenticationType.java | 53 + .../CheckNameAvailabilityReason.java | 53 + .../CheckNameAvailabilityRequest.java | 78 + .../CheckNameAvailabilityResponse.java | 40 + .../sql/v3_2014_04/DataMaskingFunction.java | 65 + .../sql/v3_2014_04/DataMaskingPolicies.java | 31 + .../sql/v3_2014_04/DataMaskingPolicy.java | 145 + .../sql/v3_2014_04/DataMaskingRule.java | 334 +++ .../sql/v3_2014_04/DataMaskingRuleState.java | 53 + .../sql/v3_2014_04/DataMaskingRules.java | 31 + .../sql/v3_2014_04/DataMaskingState.java | 53 + .../sql/v3_2014_04/DatabaseEdition.java | 68 + .../DatabaseSecurityAlertPolicy.java | 305 +++ .../DatabaseThreatDetectionPolicies.java | 31 + .../sql/v3_2014_04/DatabaseUsage.java | 56 + .../sql/v3_2014_04/DatabaseUsages.java | 30 + .../management/sql/v3_2014_04/Databases.java | 72 + .../sql/v3_2014_04/DatabasisServerMetric.java | 52 + .../DatabasisServerMetricDefinition.java | 46 + .../sql/v3_2014_04/ElasticPoolActivities.java | 30 + .../sql/v3_2014_04/ElasticPoolActivity.java | 142 + .../ElasticPoolDatabaseActivities.java | 30 + .../ElasticPoolDatabaseActivity.java | 117 + .../sql/v3_2014_04/ElasticPoolEdition.java | 44 + .../v3_2014_04/ElasticPoolServerMetric.java | 52 + .../ElasticPoolServerMetricDefinition.java | 46 + .../sql/v3_2014_04/ElasticPools.java | 42 + .../sql/v3_2014_04/ExportRequest.java | 175 ++ .../sql/v3_2014_04/FirewallRule.java | 125 + .../sql/v3_2014_04/FirewallRules.java | 53 + .../sql/v3_2014_04/GeoBackupPolicies.java | 42 + .../sql/v3_2014_04/GeoBackupPolicy.java | 125 + .../sql/v3_2014_04/GeoBackupPolicyState.java | 53 + .../sql/v3_2014_04/ImportExportResponse.java | 250 ++ .../v3_2014_04/ImportExtensionRequest.java | 267 ++ .../sql/v3_2014_04/ImportRequest.java | 132 + .../sql/v3_2014_04/MetricAvailability.java | 47 + .../management/sql/v3_2014_04/MetricName.java | 47 + .../sql/v3_2014_04/MetricValue.java | 108 + .../sql/v3_2014_04/OperationImpact.java | 77 + .../v3_2014_04/PrimaryAggregationType.java | 53 + .../v3_2014_04/RecommendedElasticPool.java | 95 + .../RecommendedElasticPoolMetric.java | 36 + .../v3_2014_04/RecommendedElasticPools.java | 52 + .../sql/v3_2014_04/RecommendedIndex.java | 210 ++ .../v3_2014_04/RecommendedIndexAction.java | 56 + .../sql/v3_2014_04/RecommendedIndexState.java | 80 + .../sql/v3_2014_04/RecommendedIndexType.java | 59 + .../sql/v3_2014_04/RecoverableDatabase.java | 58 + .../sql/v3_2014_04/RecoverableDatabases.java | 40 + .../sql/v3_2014_04/ReplicationLink.java | 93 + .../sql/v3_2014_04/ReplicationLinks.java | 79 + .../sql/v3_2014_04/ReplicationRole.java | 62 + .../sql/v3_2014_04/ReplicationState.java | 47 + .../v3_2014_04/RestorableDroppedDatabase.java | 83 + .../RestorableDroppedDatabases.java | 40 + ...SecurityAlertPolicyEmailAccountAdmins.java | 53 + .../v3_2014_04/SecurityAlertPolicyState.java | 56 + .../SecurityAlertPolicyUseServerDefault.java | 53 + .../ServerAzureADAdministrator.java | 146 + .../ServerAzureADAdministrators.java | 51 + .../v3_2014_04/ServerCommunicationLink.java | 125 + .../v3_2014_04/ServerCommunicationLinks.java | 53 + .../v3_2014_04/ServerConnectionPolicies.java | 30 + .../v3_2014_04/ServerConnectionPolicy.java | 120 + .../sql/v3_2014_04/ServerConnectionType.java | 56 + .../sql/v3_2014_04/ServerUsage.java | 56 + .../sql/v3_2014_04/ServerUsages.java | 29 + .../management/sql/v3_2014_04/Servers.java | 28 + .../sql/v3_2014_04/ServiceObjective.java | 62 + .../sql/v3_2014_04/ServiceObjectiveName.java | 230 ++ .../sql/v3_2014_04/ServiceObjectives.java | 40 + .../sql/v3_2014_04/ServiceTierAdvisor.java | 135 + .../sql/v3_2014_04/ServiceTierAdvisors.java | 42 + .../sql/v3_2014_04/SloUsageMetric.java | 72 + .../sql/v3_2014_04/StorageKeyType.java | 53 + .../v3_2014_04/TransparentDataEncryption.java | 45 + .../TransparentDataEncryptionActivities.java | 30 + .../TransparentDataEncryptionActivity.java | 50 + ...ansparentDataEncryptionActivityStatus.java | 41 + .../TransparentDataEncryptionStatus.java | 53 + .../TransparentDataEncryptions.java | 41 + .../sql/v3_2014_04/UnitDefinitionType.java | 53 + .../management/sql/v3_2014_04/UnitType.java | 53 + .../CheckNameAvailabilityResponseImpl.java | 47 + .../CheckNameAvailabilityResponseInner.java | 82 + .../DataMaskingPoliciesImpl.java | 55 + .../DataMaskingPoliciesInner.java | 263 ++ .../implementation/DataMaskingPolicyImpl.java | 138 + .../DataMaskingPolicyInner.java | 138 + .../implementation/DataMaskingRuleImpl.java | 235 ++ .../implementation/DataMaskingRuleInner.java | 367 +++ .../implementation/DataMaskingRulesImpl.java | 62 + .../implementation/DataMaskingRulesInner.java | 277 ++ .../DatabaseSecurityAlertPolicyImpl.java | 202 ++ .../DatabaseSecurityAlertPolicyInner.java | 284 ++ .../DatabaseThreatDetectionPoliciesImpl.java | 55 + .../DatabaseThreatDetectionPoliciesInner.java | 264 ++ .../implementation/DatabaseUsageImpl.java | 66 + .../implementation/DatabaseUsageInner.java | 123 + .../implementation/DatabaseUsagesImpl.java | 53 + .../implementation/DatabaseUsagesInner.java | 159 ++ .../implementation/DatabasesImpl.java | 116 + .../implementation/DatabasesInner.java | 845 ++++++ .../DatabasisServerMetricDefinitionImpl.java | 60 + .../DatabasisServerMetricImpl.java | 65 + .../ElasticPoolActivitiesImpl.java | 49 + .../ElasticPoolActivitiesInner.java | 159 ++ .../ElasticPoolActivityImpl.java | 148 ++ .../ElasticPoolActivityInner.java | 348 +++ .../ElasticPoolDatabaseActivitiesImpl.java | 49 + .../ElasticPoolDatabaseActivitiesInner.java | 159 ++ .../ElasticPoolDatabaseActivityImpl.java | 123 + .../ElasticPoolDatabaseActivityInner.java | 273 ++ ...ElasticPoolServerMetricDefinitionImpl.java | 60 + .../ElasticPoolServerMetricImpl.java | 65 + .../implementation/ElasticPoolsImpl.java | 76 + .../implementation/ElasticPoolsInner.java | 268 ++ .../implementation/FirewallRuleImpl.java | 126 + .../implementation/FirewallRuleInner.java | 105 + .../implementation/FirewallRulesImpl.java | 81 + .../implementation/FirewallRulesInner.java | 456 ++++ .../implementation/GeoBackupPoliciesImpl.java | 74 + .../GeoBackupPoliciesInner.java | 368 +++ .../implementation/GeoBackupPolicyImpl.java | 128 + .../implementation/GeoBackupPolicyInner.java | 94 + .../implementation/IdParsingUtils.java | 57 + .../ImportExportResponseImpl.java | 219 ++ .../ImportExportResponseInner.java | 156 ++ .../implementation/MetricDefinitionInner.java | 100 + .../implementation/MetricInner.java | 113 + .../v3_2014_04/implementation/PageImpl.java | 75 + .../RecommendedElasticPoolImpl.java | 124 + .../RecommendedElasticPoolInner.java | 235 ++ .../RecommendedElasticPoolMetricImpl.java | 46 + .../RecommendedElasticPoolMetricInner.java | 97 + .../RecommendedElasticPoolsImpl.java | 88 + .../RecommendedElasticPoolsInner.java | 351 +++ .../RecoverableDatabaseImpl.java | 78 + .../RecoverableDatabaseInner.java | 81 + .../RecoverableDatabasesImpl.java | 65 + .../RecoverableDatabasesInner.java | 249 ++ .../implementation/ReplicationLinkImpl.java | 117 + .../implementation/ReplicationLinkInner.java | 194 ++ .../implementation/ReplicationLinksImpl.java | 84 + .../implementation/ReplicationLinksInner.java | 749 ++++++ .../RestorableDroppedDatabaseImpl.java | 103 + .../RestorableDroppedDatabaseInner.java | 156 ++ .../RestorableDroppedDatabasesImpl.java | 65 + .../RestorableDroppedDatabasesInner.java | 249 ++ .../ServerAzureADAdministratorImpl.java | 137 + .../ServerAzureADAdministratorInner.java | 135 + .../ServerAzureADAdministratorsImpl.java | 81 + .../ServerAzureADAdministratorsInner.java | 598 +++++ .../ServerCommunicationLinkImpl.java | 126 + .../ServerCommunicationLinkInner.java | 92 + .../ServerCommunicationLinksImpl.java | 81 + .../ServerCommunicationLinksInner.java | 544 ++++ .../ServerConnectionPoliciesImpl.java | 55 + .../ServerConnectionPoliciesInner.java | 251 ++ .../ServerConnectionPolicyImpl.java | 120 + .../ServerConnectionPolicyInner.java | 78 + .../implementation/ServerUsageImpl.java | 66 + .../implementation/ServerUsageInner.java | 123 + .../implementation/ServerUsagesImpl.java | 53 + .../implementation/ServerUsagesInner.java | 152 ++ .../implementation/ServersImpl.java | 42 + .../implementation/ServersInner.java | 143 + .../implementation/ServiceObjectiveImpl.java | 82 + .../implementation/ServiceObjectiveInner.java | 96 + .../implementation/ServiceObjectivesImpl.java | 65 + .../ServiceObjectivesInner.java | 249 ++ .../ServiceTierAdvisorImpl.java | 158 ++ .../ServiceTierAdvisorInner.java | 318 +++ .../ServiceTierAdvisorsImpl.java | 65 + .../ServiceTierAdvisorsInner.java | 263 ++ .../SqlManagementClientImpl.java | 504 ++++ .../v3_2014_04/implementation/SqlManager.java | 363 +++ ...ansparentDataEncryptionActivitiesImpl.java | 49 + ...nsparentDataEncryptionActivitiesInner.java | 160 ++ ...TransparentDataEncryptionActivityImpl.java | 57 + ...ransparentDataEncryptionActivityInner.java | 68 + .../TransparentDataEncryptionImpl.java | 52 + .../TransparentDataEncryptionInner.java | 63 + .../TransparentDataEncryptionsImpl.java | 54 + .../TransparentDataEncryptionsInner.java | 352 +++ .../implementation/package-info.java | 11 + .../sql/v3_2014_04/package-info.java | 11 + sql/resource-manager/v3_2015_05/pom.xml | 133 + .../AutomaticTuningDisabledReason.java | 68 + .../sql/v3_2015_05/AutomaticTuningMode.java | 59 + .../AutomaticTuningOptionModeActual.java | 53 + .../AutomaticTuningOptionModeDesired.java | 56 + .../v3_2015_05/AutomaticTuningOptions.java | 93 + .../v3_2015_05/DatabaseAutomaticTuning.java | 51 + .../v3_2015_05/DatabaseAutomaticTunings.java | 43 + .../sql/v3_2015_05/EncryptionProtector.java | 70 + .../sql/v3_2015_05/EncryptionProtectors.java | 51 + .../sql/v3_2015_05/FailoverGroup.java | 217 ++ .../FailoverGroupReadOnlyEndpoint.java | 44 + .../FailoverGroupReadWriteEndpoint.java | 73 + .../FailoverGroupReplicationRole.java | 41 + .../sql/v3_2015_05/FailoverGroupUpdate.java | 125 + .../sql/v3_2015_05/FailoverGroups.java | 75 + .../sql/v3_2015_05/IdentityType.java | 38 + .../sql/v3_2015_05/ManagedInstance.java | 323 +++ .../sql/v3_2015_05/ManagedInstanceUpdate.java | 329 +++ .../sql/v3_2015_05/ManagedInstances.java | 25 + .../management/sql/v3_2015_05/Operation.java | 41 + .../sql/v3_2015_05/OperationDisplay.java | 78 + .../sql/v3_2015_05/OperationOrigin.java | 41 + .../management/sql/v3_2015_05/Operations.java | 27 + .../sql/v3_2015_05/PartnerInfo.java | 74 + .../ReadOnlyEndpointFailoverPolicy.java | 41 + .../ReadWriteEndpointFailoverPolicy.java | 41 + .../sql/v3_2015_05/ResourceIdentity.java | 76 + .../management/sql/v3_2015_05/Server.java | 173 ++ .../management/sql/v3_2015_05/ServerKey.java | 211 ++ .../sql/v3_2015_05/ServerKeyType.java | 41 + .../management/sql/v3_2015_05/ServerKeys.java | 53 + .../sql/v3_2015_05/ServerUpdate.java | 155 ++ .../management/sql/v3_2015_05/Servers.java | 25 + .../azure/management/sql/v3_2015_05/Sku.java | 152 ++ .../sql/v3_2015_05/SubscriptionUsage.java | 57 + .../sql/v3_2015_05/SubscriptionUsages.java | 37 + .../management/sql/v3_2015_05/SyncAgent.java | 121 + .../v3_2015_05/SyncAgentKeyProperties.java | 25 + .../v3_2015_05/SyncAgentLinkedDatabase.java | 65 + .../sql/v3_2015_05/SyncAgentState.java | 44 + .../management/sql/v3_2015_05/SyncAgents.java | 76 + .../SyncConflictResolutionPolicy.java | 41 + .../v3_2015_05/SyncDatabaseIdProperties.java | 25 + .../sql/v3_2015_05/SyncDirection.java | 44 + .../sql/v3_2015_05/SyncFullSchemaTable.java | 93 + .../v3_2015_05/SyncFullSchemaTableColumn.java | 122 + .../management/sql/v3_2015_05/SyncGroup.java | 246 ++ ...tabasisServerSyncFullSchemaProperties.java | 32 + .../v3_2015_05/SyncGroupLogProperties.java | 52 + .../sql/v3_2015_05/SyncGroupLogType.java | 47 + .../sql/v3_2015_05/SyncGroupSchema.java | 70 + .../sql/v3_2015_05/SyncGroupSchemaTable.java | 70 + .../SyncGroupSchemaTableColumn.java | 95 + .../sql/v3_2015_05/SyncGroupState.java | 50 + .../management/sql/v3_2015_05/SyncGroups.java | 131 + .../management/sql/v3_2015_05/SyncMember.java | 291 ++ .../sql/v3_2015_05/SyncMemberDbType.java | 41 + .../sql/v3_2015_05/SyncMemberState.java | 89 + ...tabasisServerSyncFullSchemaProperties.java | 32 + .../sql/v3_2015_05/SyncMembers.java | 86 + .../sql/v3_2015_05/VirtualNetworkRule.java | 130 + .../v3_2015_05/VirtualNetworkRuleState.java | 50 + .../sql/v3_2015_05/VirtualNetworkRules.java | 53 + .../DatabaseAutomaticTuningImpl.java | 59 + .../DatabaseAutomaticTuningInner.java | 92 + .../DatabaseAutomaticTuningsImpl.java | 54 + .../DatabaseAutomaticTuningsInner.java | 261 ++ .../EncryptionProtectorImpl.java | 77 + .../EncryptionProtectorInner.java | 161 ++ .../EncryptionProtectorsImpl.java | 73 + .../EncryptionProtectorsInner.java | 580 ++++ .../implementation/FailoverGroupImpl.java | 208 ++ .../implementation/FailoverGroupInner.java | 202 ++ .../implementation/FailoverGroupsImpl.java | 105 + .../implementation/FailoverGroupsInner.java | 1330 ++++++++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/ManagedInstanceImpl.java | 230 ++ .../implementation/ManagedInstanceInner.java | 331 +++ .../implementation/ManagedInstancesImpl.java | 138 + .../implementation/ManagedInstancesInner.java | 1145 ++++++++ .../implementation/OperationImpl.java | 49 + .../implementation/OperationInner.java | 82 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../v3_2015_05/implementation/PageImpl.java | 75 + .../v3_2015_05/implementation/ServerImpl.java | 139 + .../implementation/ServerInner.java | 172 ++ .../implementation/ServerKeyImpl.java | 161 ++ .../implementation/ServerKeyInner.java | 184 ++ .../implementation/ServerKeysImpl.java | 81 + .../implementation/ServerKeysInner.java | 777 ++++++ .../implementation/ServersImpl.java | 138 + .../implementation/ServersInner.java | 1145 ++++++++ .../SqlManagementClientImpl.java | 350 +++ .../v3_2015_05/implementation/SqlManager.java | 231 ++ .../implementation/SubscriptionUsageImpl.java | 75 + .../SubscriptionUsageInner.java | 80 + .../SubscriptionUsagesImpl.java | 72 + .../SubscriptionUsagesInner.java | 386 +++ .../implementation/SyncAgentImpl.java | 131 + .../implementation/SyncAgentInner.java | 139 + .../SyncAgentKeyPropertiesImpl.java | 31 + .../SyncAgentKeyPropertiesInner.java | 32 + .../SyncAgentLinkedDatabaseImpl.java | 76 + .../SyncAgentLinkedDatabaseInner.java | 112 + .../implementation/SyncAgentsImpl.java | 117 + .../implementation/SyncAgentsInner.java | 1287 +++++++++ .../SyncDatabaseIdPropertiesImpl.java | 35 + .../SyncDatabaseIdPropertiesInner.java | 32 + .../SyncFullSchemaPropertiesInner.java | 50 + ...sisServerSyncFullSchemaPropertiesImpl.java | 43 + .../implementation/SyncGroupImpl.java | 177 ++ .../implementation/SyncGroupInner.java | 212 ++ .../SyncGroupLogPropertiesImpl.java | 63 + .../SyncGroupLogPropertiesInner.java | 111 + .../implementation/SyncGroupsImpl.java | 168 ++ .../implementation/SyncGroupsInner.java | 2362 +++++++++++++++++ .../implementation/SyncMemberImpl.java | 197 ++ .../implementation/SyncMemberInner.java | 255 ++ ...sisServerSyncFullSchemaPropertiesImpl.java | 43 + .../implementation/SyncMembersImpl.java | 110 + .../implementation/SyncMembersInner.java | 1557 +++++++++++ .../VirtualNetworkRuleImpl.java | 122 + .../VirtualNetworkRuleInner.java | 90 + .../VirtualNetworkRulesImpl.java | 81 + .../VirtualNetworkRulesInner.java | 777 ++++++ .../implementation/package-info.java | 11 + .../sql/v3_2015_05/package-info.java | 11 + sql/resource-manager/v3_2017_03/pom.xml | 133 + .../AutomaticTuningOptionModeActual.java | 53 + .../AutomaticTuningOptionModeDesired.java | 56 + .../v3_2017_03/AutomaticTuningServerMode.java | 56 + .../AutomaticTuningServerOptions.java | 91 + .../AutomaticTuningServerReason.java | 56 + .../BackupLongTermRetentionPolicies.java | 42 + .../BackupLongTermRetentionPolicy.java | 185 ++ .../v3_2017_03/BlobAuditingPolicyState.java | 53 + .../sql/v3_2017_03/CatalogCollationType.java | 41 + .../CompleteDatabaseRestoreDefinition.java | 44 + .../CreateDatabaseRestorePointDefinition.java | 44 + .../DatabaseBlobAuditingPolicies.java | 31 + .../DatabaseBlobAuditingPolicy.java | 282 ++ .../DatabaseVulnerabilityAssessment.java | 185 ++ ...seVulnerabilityAssessmentRuleBaseline.java | 111 + ...lnerabilityAssessmentRuleBaselineItem.java | 45 + ...eVulnerabilityAssessmentRuleBaselines.java | 51 + .../DatabaseVulnerabilityAssessments.java | 54 + ...xecutionJobJobAgentServerJobExecution.java | 104 + ...ionJobJobAgentServerJobExecutionModel.java | 102 + .../ExtendedDatabaseBlobAuditingPolicies.java | 31 + .../ExtendedDatabaseBlobAuditingPolicy.java | 302 +++ .../ExtendedServerBlobAuditingPolicies.java | 30 + .../ExtendedServerBlobAuditingPolicy.java | 302 +++ .../azure/management/sql/v3_2017_03/Job.java | 140 + .../management/sql/v3_2017_03/JobAgent.java | 171 ++ .../JobAgentServerJobExecution.java | 151 ++ .../sql/v3_2017_03/JobAgentState.java | 50 + .../sql/v3_2017_03/JobAgentUpdate.java | 44 + .../management/sql/v3_2017_03/JobAgents.java | 53 + .../sql/v3_2017_03/JobCredential.java | 115 + .../sql/v3_2017_03/JobCredentials.java | 56 + .../sql/v3_2017_03/JobExecutionLifecycle.java | 65 + .../sql/v3_2017_03/JobExecutionTarget.java | 63 + .../sql/v3_2017_03/JobExecutions.java | 88 + .../sql/v3_2017_03/JobSchedule.java | 149 ++ .../sql/v3_2017_03/JobScheduleType.java | 53 + .../management/sql/v3_2017_03/JobStep.java | 204 ++ .../sql/v3_2017_03/JobStepAction.java | 96 + .../sql/v3_2017_03/JobStepActionSource.java | 38 + .../sql/v3_2017_03/JobStepActionType.java | 38 + .../v3_2017_03/JobStepExecutionOptions.java | 149 ++ .../sql/v3_2017_03/JobStepExecutions.java | 45 + .../sql/v3_2017_03/JobStepOutput.java | 227 ++ .../sql/v3_2017_03/JobStepOutputType.java | 38 + .../management/sql/v3_2017_03/JobSteps.java | 86 + .../management/sql/v3_2017_03/JobTarget.java | 204 ++ .../sql/v3_2017_03/JobTargetExecutions.java | 61 + .../sql/v3_2017_03/JobTargetGroup.java | 111 + .../JobTargetGroupMembershipType.java | 53 + .../sql/v3_2017_03/JobTargetGroups.java | 56 + .../sql/v3_2017_03/JobTargetType.java | 50 + .../management/sql/v3_2017_03/JobVersion.java | 37 + .../sql/v3_2017_03/JobVersions.java | 44 + .../azure/management/sql/v3_2017_03/Jobs.java | 56 + .../v3_2017_03/LongTermRetentionBackup.java | 68 + .../v3_2017_03/LongTermRetentionBackups.java | 74 + .../LongTermRetentionDatabaseState.java | 44 + ...nagedBackupShortTermRetentionPolicies.java | 42 + ...ManagedBackupShortTermRetentionPolicy.java | 90 + .../sql/v3_2017_03/ManagedDatabase.java | 327 +++ .../v3_2017_03/ManagedDatabaseCreateMode.java | 44 + .../sql/v3_2017_03/ManagedDatabaseStatus.java | 50 + .../sql/v3_2017_03/ManagedDatabaseUpdate.java | 319 +++ .../sql/v3_2017_03/ManagedDatabases.java | 70 + .../sql/v3_2017_03/ProvisioningState.java | 50 + .../sql/v3_2017_03/RestorePoint.java | 63 + .../sql/v3_2017_03/RestorePointType.java | 53 + .../sql/v3_2017_03/RestorePoints.java | 67 + .../v3_2017_03/SecurityAlertPolicyState.java | 56 + .../sql/v3_2017_03/ServerAutomaticTuning.java | 51 + .../v3_2017_03/ServerAutomaticTunings.java | 41 + .../ServerBlobAuditingPolicies.java | 30 + .../v3_2017_03/ServerBlobAuditingPolicy.java | 277 ++ .../sql/v3_2017_03/ServerDnsAlias.java | 90 + .../v3_2017_03/ServerDnsAliasAcquisition.java | 44 + .../sql/v3_2017_03/ServerDnsAliases.java | 64 + .../ServerSecurityAlertPolicies.java | 30 + .../v3_2017_03/ServerSecurityAlertPolicy.java | 251 ++ .../azure/management/sql/v3_2017_03/Sku.java | 152 ++ ...erabilityAssessmentPolicyBaselineName.java | 53 + ...ityAssessmentRecurringScansProperties.java | 98 + .../BackupLongTermRetentionPoliciesImpl.java | 67 + .../BackupLongTermRetentionPoliciesInner.java | 450 ++++ .../BackupLongTermRetentionPolicyImpl.java | 139 + .../BackupLongTermRetentionPolicyInner.java | 124 + .../DatabaseBlobAuditingPoliciesImpl.java | 55 + .../DatabaseBlobAuditingPoliciesInner.java | 264 ++ .../DatabaseBlobAuditingPolicyImpl.java | 191 ++ .../DatabaseBlobAuditingPolicyInner.java | 443 ++++ .../DatabaseVulnerabilityAssessmentImpl.java | 140 + .../DatabaseVulnerabilityAssessmentInner.java | 132 + ...lnerabilityAssessmentRuleBaselineImpl.java | 120 + ...nerabilityAssessmentRuleBaselineInner.java | 48 + ...nerabilityAssessmentRuleBaselinesImpl.java | 72 + ...erabilityAssessmentRuleBaselinesInner.java | 408 +++ .../DatabaseVulnerabilityAssessmentsImpl.java | 81 + ...DatabaseVulnerabilityAssessmentsInner.java | 618 +++++ ...tionJobJobAgentServerJobExecutionImpl.java | 133 + ...obJobAgentServerJobExecutionModelImpl.java | 115 + ...endedDatabaseBlobAuditingPoliciesImpl.java | 55 + ...ndedDatabaseBlobAuditingPoliciesInner.java | 264 ++ ...xtendedDatabaseBlobAuditingPolicyImpl.java | 197 ++ ...tendedDatabaseBlobAuditingPolicyInner.java | 454 ++++ ...xtendedServerBlobAuditingPoliciesImpl.java | 55 + ...tendedServerBlobAuditingPoliciesInner.java | 332 +++ .../ExtendedServerBlobAuditingPolicyImpl.java | 194 ++ ...ExtendedServerBlobAuditingPolicyInner.java | 454 ++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/JobAgentImpl.java | 146 + .../implementation/JobAgentInner.java | 90 + .../JobAgentServerJobExecutionImpl.java | 170 ++ .../implementation/JobAgentsImpl.java | 81 + .../implementation/JobAgentsInner.java | 1139 ++++++++ .../implementation/JobCredentialImpl.java | 119 + .../implementation/JobCredentialInner.java | 73 + .../implementation/JobCredentialsImpl.java | 81 + .../implementation/JobCredentialsInner.java | 637 +++++ .../implementation/JobExecutionInner.java | 235 ++ .../implementation/JobExecutionsImpl.java | 112 + .../implementation/JobExecutionsInner.java | 1534 +++++++++++ .../v3_2017_03/implementation/JobImpl.java | 125 + .../v3_2017_03/implementation/JobInner.java | 88 + .../implementation/JobStepExecutionsImpl.java | 76 + .../JobStepExecutionsInner.java | 630 +++++ .../implementation/JobStepImpl.java | 169 ++ .../implementation/JobStepInner.java | 183 ++ .../implementation/JobStepsImpl.java | 111 + .../implementation/JobStepsInner.java | 1044 ++++++++ .../JobTargetExecutionsImpl.java | 85 + .../JobTargetExecutionsInner.java | 1101 ++++++++ .../implementation/JobTargetGroupImpl.java | 116 + .../implementation/JobTargetGroupInner.java | 48 + .../implementation/JobTargetGroupsImpl.java | 81 + .../implementation/JobTargetGroupsInner.java | 640 +++++ .../implementation/JobVersionImpl.java | 61 + .../implementation/JobVersionInner.java | 17 + .../implementation/JobVersionsImpl.java | 65 + .../implementation/JobVersionsInner.java | 428 +++ .../v3_2017_03/implementation/JobsImpl.java | 81 + .../v3_2017_03/implementation/JobsInner.java | 637 +++++ .../LongTermRetentionBackupImpl.java | 90 + .../LongTermRetentionBackupInner.java | 111 + .../LongTermRetentionBackupsImpl.java | 108 + .../LongTermRetentionBackupsInner.java | 1468 ++++++++++ ...dBackupShortTermRetentionPoliciesImpl.java | 74 + ...BackupShortTermRetentionPoliciesInner.java | 1135 ++++++++ ...gedBackupShortTermRetentionPolicyImpl.java | 100 + ...edBackupShortTermRetentionPolicyInner.java | 47 + .../implementation/ManagedDatabaseImpl.java | 277 ++ .../implementation/ManagedDatabaseInner.java | 296 +++ .../implementation/ManagedDatabasesImpl.java | 96 + .../implementation/ManagedDatabasesInner.java | 1156 ++++++++ .../v3_2017_03/implementation/PageImpl.java | 75 + .../v3_2017_03/implementation/PageImpl1.java | 75 + .../implementation/RestorePointImpl.java | 86 + .../implementation/RestorePointInner.java | 98 + .../implementation/RestorePointsImpl.java | 84 + .../implementation/RestorePointsInner.java | 567 ++++ .../ServerAutomaticTuningImpl.java | 59 + .../ServerAutomaticTuningInner.java | 92 + .../ServerAutomaticTuningsImpl.java | 54 + .../ServerAutomaticTuningsInner.java | 247 ++ .../ServerBlobAuditingPoliciesImpl.java | 55 + .../ServerBlobAuditingPoliciesInner.java | 332 +++ .../ServerBlobAuditingPolicyImpl.java | 183 ++ .../ServerBlobAuditingPolicyInner.java | 428 +++ .../implementation/ServerDnsAliasImpl.java | 99 + .../implementation/ServerDnsAliasInner.java | 35 + .../implementation/ServerDnsAliasesImpl.java | 87 + .../implementation/ServerDnsAliasesInner.java | 1115 ++++++++ .../ServerSecurityAlertPoliciesImpl.java | 55 + .../ServerSecurityAlertPoliciesInner.java | 332 +++ .../ServerSecurityAlertPolicyImpl.java | 171 ++ .../ServerSecurityAlertPolicyInner.java | 210 ++ .../SqlManagementClientImpl.java | 504 ++++ .../v3_2017_03/implementation/SqlManager.java | 363 +++ .../implementation/package-info.java | 11 + .../sql/v3_2017_03/package-info.java | 11 + sql/resource-manager/v3_2017_10/pom.xml | 133 + .../BackupShortTermRetentionPolicies.java | 42 + .../BackupShortTermRetentionPolicy.java | 90 + .../sql/v3_2017_10/Capabilities.java | 26 + .../sql/v3_2017_10/CapabilityGroup.java | 44 + .../sql/v3_2017_10/CapabilityStatus.java | 59 + .../sql/v3_2017_10/CatalogCollationType.java | 41 + .../management/sql/v3_2017_10/CreateMode.java | 65 + .../management/sql/v3_2017_10/Database.java | 613 +++++ .../sql/v3_2017_10/DatabaseLicenseType.java | 41 + .../sql/v3_2017_10/DatabaseOperation.java | 106 + .../sql/v3_2017_10/DatabaseOperations.java | 44 + .../sql/v3_2017_10/DatabaseReadScale.java | 41 + .../sql/v3_2017_10/DatabaseStatus.java | 89 + .../sql/v3_2017_10/DatabaseUpdate.java | 712 +++++ .../DatabaseVulnerabilityAssessment.java | 185 ++ ...seVulnerabilityAssessmentRuleBaseline.java | 111 + ...lnerabilityAssessmentRuleBaselineItem.java | 45 + .../DatabaseVulnerabilityAssessmentScans.java | 66 + ...aseVulnerabilityAssessmentScansExport.java | 40 + .../management/sql/v3_2017_10/Databases.java | 109 + .../sql/v3_2017_10/EditionCapability.java | 105 + .../sql/v3_2017_10/ElasticPool.java | 267 ++ .../ElasticPoolEditionCapability.java | 105 + .../v3_2017_10/ElasticPoolLicenseType.java | 41 + .../sql/v3_2017_10/ElasticPoolOperation.java | 106 + .../sql/v3_2017_10/ElasticPoolOperations.java | 44 + ...DatabaseMaxPerformanceLevelCapability.java | 106 + ...DatabaseMinPerformanceLevelCapability.java | 90 + .../ElasticPoolPerDatabaseSettings.java | 69 + ...ElasticPoolPerformanceLevelCapability.java | 180 ++ .../sql/v3_2017_10/ElasticPoolState.java | 44 + .../sql/v3_2017_10/ElasticPoolUpdate.java | 179 ++ .../sql/v3_2017_10/ElasticPools.java | 53 + .../sql/v3_2017_10/InstanceFailoverGroup.java | 166 ++ ...InstanceFailoverGroupReadOnlyEndpoint.java | 44 + ...nstanceFailoverGroupReadWriteEndpoint.java | 73 + .../InstanceFailoverGroupReplicationRole.java | 41 + .../v3_2017_10/InstanceFailoverGroups.java | 75 + .../sql/v3_2017_10/LicenseTypeCapability.java | 74 + .../sql/v3_2017_10/LocationCapabilities.java | 46 + .../sql/v3_2017_10/LogSizeCapability.java | 48 + .../sql/v3_2017_10/LogSizeUnit.java | 50 + ...eVulnerabilityAssessmentRuleBaselines.java | 51 + ...dDatabaseVulnerabilityAssessmentScans.java | 67 + ...nagedDatabaseVulnerabilityAssessments.java | 59 + .../ManagedInstanceEditionCapability.java | 90 + .../ManagedInstanceEncryptionProtector.java | 60 + .../ManagedInstanceEncryptionProtectors.java | 51 + .../ManagedInstanceFamilyCapability.java | 150 ++ .../sql/v3_2017_10/ManagedInstanceKey.java | 141 + .../sql/v3_2017_10/ManagedInstanceKeys.java | 53 + .../v3_2017_10/ManagedInstancePairInfo.java | 69 + .../ManagedInstanceTdeCertificates.java | 31 + .../ManagedInstanceVcoresCapability.java | 89 + .../ManagedInstanceVersionCapability.java | 90 + ...anceVulnerabilityAssessmentScanRecord.java | 79 + .../v3_2017_10/ManagementOperationState.java | 53 + .../sql/v3_2017_10/MaxSizeCapability.java | 48 + .../v3_2017_10/MaxSizeRangeCapability.java | 120 + .../sql/v3_2017_10/MaxSizeUnit.java | 47 + .../sql/v3_2017_10/PartnerRegionInfo.java | 59 + .../PerformanceLevelCapability.java | 48 + .../sql/v3_2017_10/PerformanceLevelUnit.java | 41 + .../ReadOnlyEndpointFailoverPolicy.java | 41 + .../ReadWriteEndpointFailoverPolicy.java | 41 + .../v3_2017_10/ResourceMoveDefinition.java | 43 + .../management/sql/v3_2017_10/SampleName.java | 44 + .../sql/v3_2017_10/ServerKeyType.java | 41 + .../v3_2017_10/ServerVersionCapability.java | 105 + ...rverVulnerabilityAssessmentScanRecord.java | 79 + .../ServiceObjectiveCapability.java | 166 ++ .../azure/management/sql/v3_2017_10/Sku.java | 152 ++ .../sql/v3_2017_10/TdeCertificates.java | 31 + ...erabilityAssessmentPolicyBaselineName.java | 53 + ...ityAssessmentRecurringScansProperties.java | 98 + .../VulnerabilityAssessmentScanError.java | 47 + .../VulnerabilityAssessmentScanState.java | 47 + ...ulnerabilityAssessmentScanTriggerType.java | 41 + .../BackupShortTermRetentionPoliciesImpl.java | 74 + ...BackupShortTermRetentionPoliciesInner.java | 1135 ++++++++ .../BackupShortTermRetentionPolicyImpl.java | 100 + .../BackupShortTermRetentionPolicyInner.java | 47 + .../implementation/CapabilitiesImpl.java | 42 + .../implementation/CapabilitiesInner.java | 217 ++ .../implementation/DatabaseImpl.java | 467 ++++ .../implementation/DatabaseInner.java | 723 +++++ .../implementation/DatabaseOperationImpl.java | 117 + .../DatabaseOperationInner.java | 233 ++ .../DatabaseOperationsImpl.java | 61 + .../DatabaseOperationsInner.java | 417 +++ .../DatabaseVulnerabilityAssessmentImpl.java | 140 + .../DatabaseVulnerabilityAssessmentInner.java | 132 + ...lnerabilityAssessmentRuleBaselineImpl.java | 120 + ...nerabilityAssessmentRuleBaselineInner.java | 48 + ...ulnerabilityAssessmentScansExportImpl.java | 46 + ...lnerabilityAssessmentScansExportInner.java | 36 + ...abaseVulnerabilityAssessmentScansImpl.java | 94 + ...baseVulnerabilityAssessmentScansInner.java | 717 +++++ .../implementation/DatabasesImpl.java | 135 + .../implementation/DatabasesInner.java | 1862 +++++++++++++ .../implementation/ElasticPoolImpl.java | 238 ++ .../implementation/ElasticPoolInner.java | 205 ++ .../ElasticPoolOperationImpl.java | 116 + .../ElasticPoolOperationInner.java | 231 ++ .../ElasticPoolOperationsImpl.java | 61 + .../ElasticPoolOperationsInner.java | 417 +++ .../implementation/ElasticPoolsImpl.java | 81 + .../implementation/ElasticPoolsInner.java | 1095 ++++++++ .../implementation/IdParsingUtils.java | 57 + .../InstanceFailoverGroupImpl.java | 154 ++ .../InstanceFailoverGroupInner.java | 161 ++ .../InstanceFailoverGroupsImpl.java | 105 + .../InstanceFailoverGroupsInner.java | 1134 ++++++++ .../LocationCapabilitiesImpl.java | 55 + .../LocationCapabilitiesInner.java | 108 + ...nerabilityAssessmentRuleBaselinesImpl.java | 72 + ...erabilityAssessmentRuleBaselinesInner.java | 408 +++ ...abaseVulnerabilityAssessmentScansImpl.java | 85 + ...baseVulnerabilityAssessmentScansInner.java | 717 +++++ ...dDatabaseVulnerabilityAssessmentsImpl.java | 89 + ...DatabaseVulnerabilityAssessmentsInner.java | 618 +++++ ...anagedInstanceEncryptionProtectorImpl.java | 67 + ...nagedInstanceEncryptionProtectorInner.java | 120 + ...nagedInstanceEncryptionProtectorsImpl.java | 73 + ...agedInstanceEncryptionProtectorsInner.java | 580 ++++ .../ManagedInstanceKeyImpl.java | 133 + .../ManagedInstanceKeyInner.java | 122 + .../ManagedInstanceKeysImpl.java | 81 + .../ManagedInstanceKeysInner.java | 899 +++++++ .../ManagedInstanceTdeCertificatesImpl.java | 34 + .../ManagedInstanceTdeCertificatesInner.java | 236 ++ ...VulnerabilityAssessmentScanRecordImpl.java | 104 + .../v3_2017_10/implementation/PageImpl.java | 75 + ...VulnerabilityAssessmentScanRecordImpl.java | 104 + .../SqlManagementClientImpl.java | 392 +++ .../v3_2017_10/implementation/SqlManager.java | 267 ++ .../implementation/TdeCertificateInner.java | 72 + .../implementation/TdeCertificatesImpl.java | 34 + .../implementation/TdeCertificatesInner.java | 236 ++ ...ulnerabilityAssessmentScanRecordInner.java | 146 + .../implementation/package-info.java | 11 + .../sql/v3_2017_10/package-info.java | 11 + sql/resource-manager/v3_2018_06/pom.xml | 133 + ...anagedInstanceVulnerabilityAssessment.java | 175 ++ ...nagedInstanceVulnerabilityAssessments.java | 56 + .../ServerVulnerabilityAssessment.java | 175 ++ .../ServerVulnerabilityAssessments.java | 56 + ...ityAssessmentRecurringScansProperties.java | 98 + .../implementation/IdParsingUtils.java | 57 + ...edInstanceVulnerabilityAssessmentImpl.java | 137 + ...dInstanceVulnerabilityAssessmentInner.java | 131 + ...dInstanceVulnerabilityAssessmentsImpl.java | 88 + ...InstanceVulnerabilityAssessmentsInner.java | 590 ++++ .../v3_2018_06/implementation/PageImpl.java | 75 + .../ServerVulnerabilityAssessmentImpl.java | 137 + .../ServerVulnerabilityAssessmentInner.java | 131 + .../ServerVulnerabilityAssessmentsImpl.java | 88 + .../ServerVulnerabilityAssessmentsInner.java | 590 ++++ .../SqlManagementClientImpl.java | 210 ++ .../v3_2018_06/implementation/SqlManager.java | 111 + .../implementation/package-info.java | 11 + .../sql/v3_2018_06/package-info.java | 11 + 1293 files changed, 209255 insertions(+), 38 deletions(-) create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorListResult.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorStatus.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AutoExecuteStatus.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicyState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVault.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVaults.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Capabilities.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CapabilityStatus.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingFunction.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRule.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRuleState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRules.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseAdvisors.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicyListResult.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsage.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsages.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerAdvisor.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetric.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetricDefinition.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfiguration.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationAutoFailover.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationFailoverPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationRole.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationStatus.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurations.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/EditionCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDtuCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEditionCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMaxDtuCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMinDtuCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetric.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetricDefinition.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Extensions.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicyState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/LocationCapabilities.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeUnits.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricAvailability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricName.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricValue.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationDisplay.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationListResult.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Operations.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PerformanceLevelUnit.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PrimaryAggregationType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Queries.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryAggregationFunction.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryExecutionType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryInterval.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetric.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetricUnit.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryObservedMetricType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistic.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistics.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryText.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryTexts.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabase.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabases.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabase.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabases.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoint.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePointType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoints.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Server.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisor.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisors.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrator.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrators.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLink.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLinks.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerState.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicy.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicyListResult.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUpdate.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsage.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsages.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersion.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersionCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjective.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveCapability.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectives.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TableAuditingPolicyProperties.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TopQueries.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionConfigurations.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitDefinitionType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitType.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerAdvisorImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricDefinitionImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricDefinitionImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesInner.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsImpl.java create mode 100644 sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/pom.xml create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AdvisorStatus.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatus.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatusInheritedFrom.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningDisabledReason.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningMode.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeActual.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeDesired.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptions.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/BlobAuditingPolicyState.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAdvisors.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTuning.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTunings.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseRecommendedActions.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabasisServerAdvisor.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtector.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroup.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadOnlyEndpoint.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadWriteEndpoint.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReplicationRole.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupUpdate.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroups.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRule.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRuleList.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRules.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/IdentityType.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ImplementationMethod.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/IsRetryable.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operation.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationDisplay.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationOrigin.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operations.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/PartnerInfo.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ProxyResourceWithWritableName.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadOnlyEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadWriteEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedAction.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionCurrentState.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionErrorInfo.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImpactRecord.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImplementationInfo.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionInitiatedBy.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionMetricInfo.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ResourceIdentity.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ResourceWithWritableName.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Server.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisor.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisors.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKey.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeyType.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeys.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerUpdate.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Servers.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsage.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsages.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgent.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentKeyProperties.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentLinkedDatabase.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentState.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgents.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncConflictResolutionPolicy.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDatabaseIdProperties.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDirection.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTable.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTableColumn.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroup.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupDatabasisServerSyncFullSchemaProperties.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogProperties.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogType.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchema.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTable.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTableColumn.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupState.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroups.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMember.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberDbType.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberState.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMembers.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRule.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRuleState.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRules.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabasisServerAdvisorImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/PageImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncFullSchemaPropertiesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/package-info.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/package-info.java create mode 100644 sql/resource-manager/v2017_03_01_preview/pom.xml create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeActual.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeDesired.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerMode.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerOptions.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerReason.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BlobAuditingPolicyState.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CatalogCollationType.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CompleteDatabaseRestoreDefinition.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateDatabaseRestorePointDefinition.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateMode.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivities.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivity.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Database.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperation.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperations.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseStatus.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseUpdate.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselines.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Databases.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecution.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecutionModel.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportDatabaseDefinition.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportOperationResult.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Job.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgent.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentServerJobExecution.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentState.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentUpdate.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgents.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredential.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredentials.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionLifecycle.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionTarget.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutions.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSchedule.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobScheduleType.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStep.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepAction.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionSource.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionType.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutionOptions.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutput.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutputType.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSteps.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTarget.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetExecutions.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroup.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroupMembershipType.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroups.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetType.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersion.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersions.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Jobs.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackup.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionDatabaseState.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseUpdate.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabases.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagementOperationState.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ProvisioningState.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ResourceMoveDefinition.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoint.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePointType.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoints.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SampleName.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SecurityAlertPolicyState.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTuning.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTunings.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAlias.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliasAcquisition.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliases.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Sku.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentPolicyBaselineName.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentServerJobExecutionImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl1.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/package-info.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/package-info.java create mode 100644 sql/resource-manager/v2018_06_01_preview/pom.xml create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PageImpl.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/package-info.java create mode 100644 sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/package-info.java create mode 100644 sql/resource-manager/v3_2014_04/pom.xml create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/AuthenticationType.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityReason.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityRequest.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityResponse.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingFunction.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicies.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicy.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRule.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRuleState.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRules.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingState.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseEdition.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseSecurityAlertPolicy.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseThreatDetectionPolicies.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsage.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsages.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Databases.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetric.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetricDefinition.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivities.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivity.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivities.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivity.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolEdition.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetric.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetricDefinition.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPools.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ExportRequest.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRule.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRules.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicies.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicy.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicyState.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExportResponse.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExtensionRequest.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportRequest.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricAvailability.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricName.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricValue.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/OperationImpact.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/PrimaryAggregationType.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPool.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPoolMetric.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPools.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndex.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexAction.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexState.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexType.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabase.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabases.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLink.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLinks.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationRole.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationState.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabase.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabases.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyEmailAccountAdmins.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyState.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyUseServerDefault.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrator.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrators.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLink.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLinks.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicies.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicy.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionType.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsage.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsages.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Servers.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjective.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectiveName.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectives.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisor.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisors.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SloUsageMetric.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/StorageKeyType.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryption.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivities.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivity.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivityStatus.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionStatus.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptions.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitDefinitionType.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitType.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricDefinitionImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricDefinitionImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricDefinitionInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/PageImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManager.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsImpl.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsInner.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/package-info.java create mode 100644 sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/package-info.java create mode 100644 sql/resource-manager/v3_2015_05/pom.xml create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningDisabledReason.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningMode.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeActual.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeDesired.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptions.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTuning.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTunings.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtector.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtectors.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroup.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadOnlyEndpoint.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadWriteEndpoint.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReplicationRole.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupUpdate.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroups.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/IdentityType.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstance.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstanceUpdate.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstances.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operation.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationDisplay.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationOrigin.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operations.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/PartnerInfo.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadOnlyEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadWriteEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ResourceIdentity.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Server.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKey.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeyType.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeys.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerUpdate.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Servers.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Sku.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsage.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsages.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgent.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentKeyProperties.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentLinkedDatabase.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentState.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgents.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncConflictResolutionPolicy.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDatabaseIdProperties.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDirection.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTable.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTableColumn.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroup.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupDatabasisServerSyncFullSchemaProperties.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogProperties.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogType.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchema.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTable.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTableColumn.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupState.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroups.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMember.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberDbType.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberState.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMembers.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRule.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRuleState.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRules.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/PageImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManager.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncFullSchemaPropertiesInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesImpl.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesInner.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/package-info.java create mode 100644 sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/package-info.java create mode 100644 sql/resource-manager/v3_2017_03/pom.xml create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeActual.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeDesired.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerMode.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerOptions.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerReason.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicies.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicy.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BlobAuditingPolicyState.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CatalogCollationType.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CompleteDatabaseRestoreDefinition.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CreateDatabaseRestorePointDefinition.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaseline.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselineItem.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselines.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecution.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecutionModel.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Job.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgent.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentServerJobExecution.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentState.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentUpdate.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgents.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredential.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredentials.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionLifecycle.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionTarget.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutions.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSchedule.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobScheduleType.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStep.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepAction.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionSource.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionType.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutionOptions.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutions.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutput.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutputType.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSteps.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTarget.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetExecutions.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroup.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroupMembershipType.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroups.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetType.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersion.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersions.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Jobs.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackup.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackups.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionDatabaseState.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicies.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicy.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabase.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseCreateMode.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseStatus.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseUpdate.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabases.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ProvisioningState.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoint.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePointType.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoints.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/SecurityAlertPolicyState.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTuning.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTunings.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicies.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicy.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAlias.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliasAcquisition.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliases.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicies.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicy.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Sku.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentPolicyBaselineName.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentServerJobExecutionImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl1.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManager.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/package-info.java create mode 100644 sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/package-info.java create mode 100644 sql/resource-manager/v3_2017_10/pom.xml create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicies.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicy.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Capabilities.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityGroup.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityStatus.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CatalogCollationType.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CreateMode.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Database.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseLicenseType.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperation.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperations.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseReadScale.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseStatus.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseUpdate.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaseline.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaselineItem.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScans.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScansExport.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Databases.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/EditionCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPool.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolEditionCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolLicenseType.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperation.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperations.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseSettings.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerformanceLevelCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolState.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolUpdate.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPools.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroup.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadOnlyEndpoint.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadWriteEndpoint.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReplicationRole.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroups.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LicenseTypeCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LocationCapabilities.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeUnit.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentScans.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEditionCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtector.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtectors.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceFamilyCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKey.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKeys.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstancePairInfo.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceTdeCertificates.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVcoresCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVersionCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVulnerabilityAssessmentScanRecord.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagementOperationState.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeRangeCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeUnit.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PartnerRegionInfo.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelUnit.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadOnlyEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadWriteEndpointFailoverPolicy.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ResourceMoveDefinition.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/SampleName.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerKeyType.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVersionCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVulnerabilityAssessmentScanRecord.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServiceObjectiveCapability.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Sku.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/TdeCertificates.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentPolicyBaselineName.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanError.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanState.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanTriggerType.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/PageImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManager.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificateInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesImpl.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/VulnerabilityAssessmentScanRecordInner.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/package-info.java create mode 100644 sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/package-info.java create mode 100644 sql/resource-manager/v3_2018_06/pom.xml create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessment.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/IdParsingUtils.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/PageImpl.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManagementClientImpl.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManager.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/package-info.java create mode 100644 sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/package-info.java diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorListResult.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorListResult.java new file mode 100644 index 0000000000000..38e4be6265129 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorListResult.java @@ -0,0 +1,27 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.AdvisorListResultInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.AdvisorInner; +import java.util.List; + +/** + * Type representing AdvisorListResult. + */ +public interface AdvisorListResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorStatus.java new file mode 100644 index 0000000000000..de830b829b90d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AdvisorStatus.java @@ -0,0 +1,59 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AdvisorStatus. + */ +public enum AdvisorStatus { + /** Enum value GA. */ + GA("GA"), + + /** Enum value PublicPreview. */ + PUBLIC_PREVIEW("PublicPreview"), + + /** Enum value LimitedPublicPreview. */ + LIMITED_PUBLIC_PREVIEW("LimitedPublicPreview"), + + /** Enum value PrivatePreview. */ + PRIVATE_PREVIEW("PrivatePreview"); + + /** The actual serialized value for a AdvisorStatus instance. */ + private String value; + + AdvisorStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdvisorStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AdvisorStatus object, or null if unable to parse. + */ + @JsonCreator + public static AdvisorStatus fromString(String value) { + AdvisorStatus[] items = AdvisorStatus.values(); + for (AdvisorStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AutoExecuteStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AutoExecuteStatus.java new file mode 100644 index 0000000000000..758100d774da8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AutoExecuteStatus.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutoExecuteStatus. + */ +public enum AutoExecuteStatus { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutoExecuteStatus instance. */ + private String value; + + AutoExecuteStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutoExecuteStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AutoExecuteStatus object, or null if unable to parse. + */ + @JsonCreator + public static AutoExecuteStatus fromString(String value) { + AutoExecuteStatus[] items = AutoExecuteStatus.values(); + for (AutoExecuteStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicies.java new file mode 100644 index 0000000000000..3515ee27977eb --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicies.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.BackupLongTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BackupLongTermRetentionPolicies. + */ +public interface BackupLongTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Returns a database backup 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 serverName The name of the server. + * @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 serverName, String databaseName); + + /** + * Returns a database backup 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicy.java new file mode 100644 index 0000000000000..c2c06c4ca834f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicy.java @@ -0,0 +1,120 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.BackupLongTermRetentionPolicyInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing BackupLongTermRetentionPolicy. + */ +public interface BackupLongTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recoveryServicesBackupPolicyResourceId value. + */ + String recoveryServicesBackupPolicyResourceId(); + + /** + * @return the state value. + */ + BackupLongTermRetentionPolicyState state(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the BackupLongTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithRecoveryServicesBackupPolicyResourceId, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackupLongTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackupLongTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithRecoveryServicesBackupPolicyResourceId withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify RecoveryServicesBackupPolicyResourceId. + */ + interface WithRecoveryServicesBackupPolicyResourceId { + /** + * Specifies recoveryServicesBackupPolicyResourceId. + */ + WithState withRecoveryServicesBackupPolicyResourceId(String recoveryServicesBackupPolicyResourceId); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BackupLongTermRetentionPolicyState state); + } + + /** + * 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 { + } + } + /** + * The template for a BackupLongTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of BackupLongTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicyState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicyState.java new file mode 100644 index 0000000000000..ab6a6c583943c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionPolicyState.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for BackupLongTermRetentionPolicyState. + */ +public enum BackupLongTermRetentionPolicyState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a BackupLongTermRetentionPolicyState instance. */ + private String value; + + BackupLongTermRetentionPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BackupLongTermRetentionPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed BackupLongTermRetentionPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static BackupLongTermRetentionPolicyState fromString(String value) { + BackupLongTermRetentionPolicyState[] items = BackupLongTermRetentionPolicyState.values(); + for (BackupLongTermRetentionPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVault.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVault.java new file mode 100644 index 0000000000000..0df184b3e6aab --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVault.java @@ -0,0 +1,115 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.BackupLongTermRetentionVaultInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing BackupLongTermRetentionVault. + */ +public interface BackupLongTermRetentionVault extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recoveryServicesVaultResourceId value. + */ + String recoveryServicesVaultResourceId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the BackupLongTermRetentionVault definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithRecoveryServicesVaultResourceId, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackupLongTermRetentionVault definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackupLongTermRetentionVault definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the backuplongtermretentionvault definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithRecoveryServicesVaultResourceId withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the backuplongtermretentionvault definition allowing to specify RecoveryServicesVaultResourceId. + */ + interface WithRecoveryServicesVaultResourceId { + /** + * Specifies recoveryServicesVaultResourceId. + */ + WithCreate withRecoveryServicesVaultResourceId(String recoveryServicesVaultResourceId); + } + + /** + * 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 { + } + } + /** + * The template for a BackupLongTermRetentionVault update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecoveryServicesVaultResourceId { + } + + /** + * Grouping of BackupLongTermRetentionVault update stages. + */ + interface UpdateStages { + /** + * The stage of the backuplongtermretentionvault update allowing to specify RecoveryServicesVaultResourceId. + */ + interface WithRecoveryServicesVaultResourceId { + /** + * Specifies recoveryServicesVaultResourceId. + */ + Update withRecoveryServicesVaultResourceId(String recoveryServicesVaultResourceId); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVaults.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVaults.java new file mode 100644 index 0000000000000..3db6a0d144e90 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/BackupLongTermRetentionVaults.java @@ -0,0 +1,40 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.BackupLongTermRetentionVaultsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BackupLongTermRetentionVaults. + */ +public interface BackupLongTermRetentionVaults extends SupportsCreating, HasInner { + /** + * Gets a server backup long term retention vault. + * + * @param resourceGroupName The 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 server backup long term retention vaults in 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Capabilities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Capabilities.java new file mode 100644 index 0000000000000..5752a95b7281c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Capabilities.java @@ -0,0 +1,26 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; + +/** + * Type representing Capabilities. + */ +public interface Capabilities { + /** + * Gets the capabilities available for the specified location. + * + * @param locationId The location id whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(String locationId); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CapabilityStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CapabilityStatus.java new file mode 100644 index 0000000000000..befbe507cdb42 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CapabilityStatus.java @@ -0,0 +1,59 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CapabilityStatus. + */ +public enum CapabilityStatus { + /** Enum value Visible. */ + VISIBLE("Visible"), + + /** Enum value Available. */ + AVAILABLE("Available"), + + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a CapabilityStatus instance. */ + private String value; + + CapabilityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CapabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed CapabilityStatus object, or null if unable to parse. + */ + @JsonCreator + public static CapabilityStatus fromString(String value) { + CapabilityStatus[] items = CapabilityStatus.values(); + for (CapabilityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingFunction.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingFunction.java new file mode 100644 index 0000000000000..e1641efcf178b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingFunction.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DataMaskingFunction. + */ +public enum DataMaskingFunction { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value CCN. */ + CCN("CCN"), + + /** Enum value Email. */ + EMAIL("Email"), + + /** Enum value Number. */ + NUMBER("Number"), + + /** Enum value SSN. */ + SSN("SSN"), + + /** Enum value Text. */ + TEXT("Text"); + + /** The actual serialized value for a DataMaskingFunction instance. */ + private String value; + + DataMaskingFunction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingFunction instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingFunction object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingFunction fromString(String value) { + DataMaskingFunction[] items = DataMaskingFunction.values(); + for (DataMaskingFunction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicies.java new file mode 100644 index 0000000000000..b8b1c3ead1c7b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DataMaskingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataMaskingPolicies. + */ +public interface DataMaskingPolicies extends SupportsCreating, HasInner { + /** + * Gets a database data masking 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicy.java new file mode 100644 index 0000000000000..04dd86311a828 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingPolicy.java @@ -0,0 +1,145 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DataMaskingPolicyInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing DataMaskingPolicy. + */ +public interface DataMaskingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the applicationPrincipals value. + */ + String applicationPrincipals(); + + /** + * @return the dataMaskingState value. + */ + DataMaskingState dataMaskingState(); + + /** + * @return the exemptPrincipals value. + */ + String exemptPrincipals(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maskingLevel value. + */ + String maskingLevel(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataMaskingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithDataMaskingState, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataMaskingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataMaskingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the datamaskingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithDataMaskingState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the datamaskingpolicy definition allowing to specify DataMaskingState. + */ + interface WithDataMaskingState { + /** + * Specifies dataMaskingState. + */ + WithCreate withDataMaskingState(DataMaskingState dataMaskingState); + } + + /** + * The stage of the datamaskingpolicy definition allowing to specify ExemptPrincipals. + */ + interface WithExemptPrincipals { + /** + * Specifies exemptPrincipals. + */ + WithCreate withExemptPrincipals(String exemptPrincipals); + } + + /** + * 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.WithExemptPrincipals { + } + } + /** + * The template for a DataMaskingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithExemptPrincipals { + } + + /** + * Grouping of DataMaskingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the datamaskingpolicy update allowing to specify ExemptPrincipals. + */ + interface WithExemptPrincipals { + /** + * Specifies exemptPrincipals. + */ + Update withExemptPrincipals(String exemptPrincipals); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRule.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRule.java new file mode 100644 index 0000000000000..99f0545650052 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRule.java @@ -0,0 +1,334 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DataMaskingRuleInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing DataMaskingRule. + */ +public interface DataMaskingRule extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the aliasName value. + */ + String aliasName(); + + /** + * @return the columnName value. + */ + String columnName(); + + /** + * @return the dataMaskingRuleId value. + */ + String dataMaskingRuleId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maskingFunction value. + */ + DataMaskingFunction maskingFunction(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberFrom value. + */ + String numberFrom(); + + /** + * @return the numberTo value. + */ + String numberTo(); + + /** + * @return the prefixSize value. + */ + String prefixSize(); + + /** + * @return the replacementString value. + */ + String replacementString(); + + /** + * @return the ruleState value. + */ + DataMaskingRuleState ruleState(); + + /** + * @return the schemaName value. + */ + String schemaName(); + + /** + * @return the suffixSize value. + */ + String suffixSize(); + + /** + * @return the tableName value. + */ + String tableName(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataMaskingRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDataMaskingPolicy, DefinitionStages.WithColumnName, DefinitionStages.WithMaskingFunction, DefinitionStages.WithSchemaName, DefinitionStages.WithTableName, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataMaskingRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataMaskingRule definition. + */ + interface Blank extends WithDataMaskingPolicy { + } + + /** + * The stage of the datamaskingrule definition allowing to specify DataMaskingPolicy. + */ + interface WithDataMaskingPolicy { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithColumnName withExistingDataMaskingPolicy(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify ColumnName. + */ + interface WithColumnName { + /** + * Specifies columnName. + */ + WithMaskingFunction withColumnName(String columnName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify MaskingFunction. + */ + interface WithMaskingFunction { + /** + * Specifies maskingFunction. + */ + WithSchemaName withMaskingFunction(DataMaskingFunction maskingFunction); + } + + /** + * The stage of the datamaskingrule definition allowing to specify SchemaName. + */ + interface WithSchemaName { + /** + * Specifies schemaName. + */ + WithTableName withSchemaName(String schemaName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify TableName. + */ + interface WithTableName { + /** + * Specifies tableName. + */ + WithCreate withTableName(String tableName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify AliasName. + */ + interface WithAliasName { + /** + * Specifies aliasName. + */ + WithCreate withAliasName(String aliasName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify NumberFrom. + */ + interface WithNumberFrom { + /** + * Specifies numberFrom. + */ + WithCreate withNumberFrom(String numberFrom); + } + + /** + * The stage of the datamaskingrule definition allowing to specify NumberTo. + */ + interface WithNumberTo { + /** + * Specifies numberTo. + */ + WithCreate withNumberTo(String numberTo); + } + + /** + * The stage of the datamaskingrule definition allowing to specify PrefixSize. + */ + interface WithPrefixSize { + /** + * Specifies prefixSize. + */ + WithCreate withPrefixSize(String prefixSize); + } + + /** + * The stage of the datamaskingrule definition allowing to specify ReplacementString. + */ + interface WithReplacementString { + /** + * Specifies replacementString. + */ + WithCreate withReplacementString(String replacementString); + } + + /** + * The stage of the datamaskingrule definition allowing to specify RuleState. + */ + interface WithRuleState { + /** + * Specifies ruleState. + */ + WithCreate withRuleState(DataMaskingRuleState ruleState); + } + + /** + * The stage of the datamaskingrule definition allowing to specify SuffixSize. + */ + interface WithSuffixSize { + /** + * Specifies suffixSize. + */ + WithCreate withSuffixSize(String suffixSize); + } + + /** + * 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.WithAliasName, DefinitionStages.WithNumberFrom, DefinitionStages.WithNumberTo, DefinitionStages.WithPrefixSize, DefinitionStages.WithReplacementString, DefinitionStages.WithRuleState, DefinitionStages.WithSuffixSize { + } + } + /** + * The template for a DataMaskingRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAliasName, UpdateStages.WithNumberFrom, UpdateStages.WithNumberTo, UpdateStages.WithPrefixSize, UpdateStages.WithReplacementString, UpdateStages.WithRuleState, UpdateStages.WithSuffixSize { + } + + /** + * Grouping of DataMaskingRule update stages. + */ + interface UpdateStages { + /** + * The stage of the datamaskingrule update allowing to specify AliasName. + */ + interface WithAliasName { + /** + * Specifies aliasName. + */ + Update withAliasName(String aliasName); + } + + /** + * The stage of the datamaskingrule update allowing to specify NumberFrom. + */ + interface WithNumberFrom { + /** + * Specifies numberFrom. + */ + Update withNumberFrom(String numberFrom); + } + + /** + * The stage of the datamaskingrule update allowing to specify NumberTo. + */ + interface WithNumberTo { + /** + * Specifies numberTo. + */ + Update withNumberTo(String numberTo); + } + + /** + * The stage of the datamaskingrule update allowing to specify PrefixSize. + */ + interface WithPrefixSize { + /** + * Specifies prefixSize. + */ + Update withPrefixSize(String prefixSize); + } + + /** + * The stage of the datamaskingrule update allowing to specify ReplacementString. + */ + interface WithReplacementString { + /** + * Specifies replacementString. + */ + Update withReplacementString(String replacementString); + } + + /** + * The stage of the datamaskingrule update allowing to specify RuleState. + */ + interface WithRuleState { + /** + * Specifies ruleState. + */ + Update withRuleState(DataMaskingRuleState ruleState); + } + + /** + * The stage of the datamaskingrule update allowing to specify SuffixSize. + */ + interface WithSuffixSize { + /** + * Specifies suffixSize. + */ + Update withSuffixSize(String suffixSize); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRuleState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRuleState.java new file mode 100644 index 0000000000000..22bc925c49e9e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRuleState.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DataMaskingRuleState. + */ +public enum DataMaskingRuleState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingRuleState instance. */ + private String value; + + DataMaskingRuleState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingRuleState instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingRuleState object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingRuleState fromString(String value) { + DataMaskingRuleState[] items = DataMaskingRuleState.values(); + for (DataMaskingRuleState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRules.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRules.java new file mode 100644 index 0000000000000..71eb8778040ab --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingRules.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DataMaskingRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataMaskingRules. + */ +public interface DataMaskingRules extends SupportsCreating, HasInner { + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingState.java new file mode 100644 index 0000000000000..7f53bc421d4f4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DataMaskingState.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DataMaskingState. + */ +public enum DataMaskingState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingState instance. */ + private String value; + + DataMaskingState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingState instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingState object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingState fromString(String value) { + DataMaskingState[] items = DataMaskingState.values(); + for (DataMaskingState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseAdvisors.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseAdvisors.java new file mode 100644 index 0000000000000..51165c95fa92e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseAdvisors.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseAdvisorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseAdvisors. + */ +public interface DatabaseAdvisors extends SupportsCreating, HasInner { + /** + * Returns a list of database advisors. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns details of a Database Advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicies.java new file mode 100644 index 0000000000000..72a8b1d8f8896 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseConnectionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseConnectionPolicies. + */ +public interface DatabaseConnectionPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection 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); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicy.java new file mode 100644 index 0000000000000..0aba6e8239680 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseConnectionPolicy.java @@ -0,0 +1,270 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseConnectionPolicyInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing DatabaseConnectionPolicy. + */ +public interface DatabaseConnectionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the proxyDnsName value. + */ + String proxyDnsName(); + + /** + * @return the proxyPort value. + */ + String proxyPort(); + + /** + * @return the redirectionState value. + */ + String redirectionState(); + + /** + * @return the securityEnabledAccess value. + */ + String securityEnabledAccess(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the useServerDefault value. + */ + String useServerDefault(); + + /** + * @return the visibility value. + */ + String visibility(); + + /** + * The entirety of the DatabaseConnectionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseConnectionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseConnectionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify ProxyDnsName. + */ + interface WithProxyDnsName { + /** + * Specifies proxyDnsName. + */ + WithCreate withProxyDnsName(String proxyDnsName); + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify ProxyPort. + */ + interface WithProxyPort { + /** + * Specifies proxyPort. + */ + WithCreate withProxyPort(String proxyPort); + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify RedirectionState. + */ + interface WithRedirectionState { + /** + * Specifies redirectionState. + */ + WithCreate withRedirectionState(String redirectionState); + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify SecurityEnabledAccess. + */ + interface WithSecurityEnabledAccess { + /** + * Specifies securityEnabledAccess. + */ + WithCreate withSecurityEnabledAccess(String securityEnabledAccess); + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(String state); + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + WithCreate withUseServerDefault(String useServerDefault); + } + + /** + * The stage of the databaseconnectionpolicy definition allowing to specify Visibility. + */ + interface WithVisibility { + /** + * Specifies visibility. + */ + WithCreate withVisibility(String visibility); + } + + /** + * 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.WithProxyDnsName, DefinitionStages.WithProxyPort, DefinitionStages.WithRedirectionState, DefinitionStages.WithSecurityEnabledAccess, DefinitionStages.WithState, DefinitionStages.WithUseServerDefault, DefinitionStages.WithVisibility { + } + } + /** + * The template for a DatabaseConnectionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithProxyDnsName, UpdateStages.WithProxyPort, UpdateStages.WithRedirectionState, UpdateStages.WithSecurityEnabledAccess, UpdateStages.WithState, UpdateStages.WithUseServerDefault, UpdateStages.WithVisibility { + } + + /** + * Grouping of DatabaseConnectionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databaseconnectionpolicy update allowing to specify ProxyDnsName. + */ + interface WithProxyDnsName { + /** + * Specifies proxyDnsName. + */ + Update withProxyDnsName(String proxyDnsName); + } + + /** + * The stage of the databaseconnectionpolicy update allowing to specify ProxyPort. + */ + interface WithProxyPort { + /** + * Specifies proxyPort. + */ + Update withProxyPort(String proxyPort); + } + + /** + * The stage of the databaseconnectionpolicy update allowing to specify RedirectionState. + */ + interface WithRedirectionState { + /** + * Specifies redirectionState. + */ + Update withRedirectionState(String redirectionState); + } + + /** + * The stage of the databaseconnectionpolicy update allowing to specify SecurityEnabledAccess. + */ + interface WithSecurityEnabledAccess { + /** + * Specifies securityEnabledAccess. + */ + Update withSecurityEnabledAccess(String securityEnabledAccess); + } + + /** + * The stage of the databaseconnectionpolicy update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + Update withState(String state); + } + + /** + * The stage of the databaseconnectionpolicy update allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + Update withUseServerDefault(String useServerDefault); + } + + /** + * The stage of the databaseconnectionpolicy update allowing to specify Visibility. + */ + interface WithVisibility { + /** + * Specifies visibility. + */ + Update withVisibility(String visibility); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicies.java new file mode 100644 index 0000000000000..1d9e5de710273 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicies.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseTableAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseTableAuditingPolicies. + */ +public interface DatabaseTableAuditingPolicies extends SupportsCreating, HasInner { + /** + * Lists a database's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit 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); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicy.java new file mode 100644 index 0000000000000..8882682922f46 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicy.java @@ -0,0 +1,396 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseTableAuditingPolicyInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing DatabaseTableAuditingPolicy. + */ +public interface DatabaseTableAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditingState value. + */ + String auditingState(); + + /** + * @return the auditLogsTableName value. + */ + String auditLogsTableName(); + + /** + * @return the eventTypesToAudit value. + */ + String eventTypesToAudit(); + + /** + * @return the fullAuditLogsTableName value. + */ + String fullAuditLogsTableName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + String retentionDays(); + + /** + * @return the storageAccountKey value. + */ + String storageAccountKey(); + + /** + * @return the storageAccountName value. + */ + String storageAccountName(); + + /** + * @return the storageAccountResourceGroupName value. + */ + String storageAccountResourceGroupName(); + + /** + * @return the storageAccountSecondaryKey value. + */ + String storageAccountSecondaryKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageTableEndpoint value. + */ + String storageTableEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the useServerDefault value. + */ + String useServerDefault(); + + /** + * The entirety of the DatabaseTableAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseTableAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseTableAuditingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify AuditingState. + */ + interface WithAuditingState { + /** + * Specifies auditingState. + */ + WithCreate withAuditingState(String auditingState); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify AuditLogsTableName. + */ + interface WithAuditLogsTableName { + /** + * Specifies auditLogsTableName. + */ + WithCreate withAuditLogsTableName(String auditLogsTableName); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify EventTypesToAudit. + */ + interface WithEventTypesToAudit { + /** + * Specifies eventTypesToAudit. + */ + WithCreate withEventTypesToAudit(String eventTypesToAudit); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify FullAuditLogsTableName. + */ + interface WithFullAuditLogsTableName { + /** + * Specifies fullAuditLogsTableName. + */ + WithCreate withFullAuditLogsTableName(String fullAuditLogsTableName); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(String retentionDays); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify StorageAccountKey. + */ + interface WithStorageAccountKey { + /** + * Specifies storageAccountKey. + */ + WithCreate withStorageAccountKey(String storageAccountKey); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify StorageAccountName. + */ + interface WithStorageAccountName { + /** + * Specifies storageAccountName. + */ + WithCreate withStorageAccountName(String storageAccountName); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify StorageAccountResourceGroupName. + */ + interface WithStorageAccountResourceGroupName { + /** + * Specifies storageAccountResourceGroupName. + */ + WithCreate withStorageAccountResourceGroupName(String storageAccountResourceGroupName); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify StorageAccountSecondaryKey. + */ + interface WithStorageAccountSecondaryKey { + /** + * Specifies storageAccountSecondaryKey. + */ + WithCreate withStorageAccountSecondaryKey(String storageAccountSecondaryKey); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify StorageTableEndpoint. + */ + interface WithStorageTableEndpoint { + /** + * Specifies storageTableEndpoint. + */ + WithCreate withStorageTableEndpoint(String storageTableEndpoint); + } + + /** + * The stage of the databasetableauditingpolicy definition allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + WithCreate withUseServerDefault(String useServerDefault); + } + + /** + * 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.WithAuditingState, DefinitionStages.WithAuditLogsTableName, DefinitionStages.WithEventTypesToAudit, DefinitionStages.WithFullAuditLogsTableName, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountKey, DefinitionStages.WithStorageAccountName, DefinitionStages.WithStorageAccountResourceGroupName, DefinitionStages.WithStorageAccountSecondaryKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageTableEndpoint, DefinitionStages.WithUseServerDefault { + } + } + /** + * The template for a DatabaseTableAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditingState, UpdateStages.WithAuditLogsTableName, UpdateStages.WithEventTypesToAudit, UpdateStages.WithFullAuditLogsTableName, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountKey, UpdateStages.WithStorageAccountName, UpdateStages.WithStorageAccountResourceGroupName, UpdateStages.WithStorageAccountSecondaryKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageTableEndpoint, UpdateStages.WithUseServerDefault { + } + + /** + * Grouping of DatabaseTableAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databasetableauditingpolicy update allowing to specify AuditingState. + */ + interface WithAuditingState { + /** + * Specifies auditingState. + */ + Update withAuditingState(String auditingState); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify AuditLogsTableName. + */ + interface WithAuditLogsTableName { + /** + * Specifies auditLogsTableName. + */ + Update withAuditLogsTableName(String auditLogsTableName); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify EventTypesToAudit. + */ + interface WithEventTypesToAudit { + /** + * Specifies eventTypesToAudit. + */ + Update withEventTypesToAudit(String eventTypesToAudit); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify FullAuditLogsTableName. + */ + interface WithFullAuditLogsTableName { + /** + * Specifies fullAuditLogsTableName. + */ + Update withFullAuditLogsTableName(String fullAuditLogsTableName); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(String retentionDays); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify StorageAccountKey. + */ + interface WithStorageAccountKey { + /** + * Specifies storageAccountKey. + */ + Update withStorageAccountKey(String storageAccountKey); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify StorageAccountName. + */ + interface WithStorageAccountName { + /** + * Specifies storageAccountName. + */ + Update withStorageAccountName(String storageAccountName); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify StorageAccountResourceGroupName. + */ + interface WithStorageAccountResourceGroupName { + /** + * Specifies storageAccountResourceGroupName. + */ + Update withStorageAccountResourceGroupName(String storageAccountResourceGroupName); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify StorageAccountSecondaryKey. + */ + interface WithStorageAccountSecondaryKey { + /** + * Specifies storageAccountSecondaryKey. + */ + Update withStorageAccountSecondaryKey(String storageAccountSecondaryKey); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify StorageTableEndpoint. + */ + interface WithStorageTableEndpoint { + /** + * Specifies storageTableEndpoint. + */ + Update withStorageTableEndpoint(String storageTableEndpoint); + } + + /** + * The stage of the databasetableauditingpolicy update allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + Update withUseServerDefault(String useServerDefault); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicyListResult.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicyListResult.java new file mode 100644 index 0000000000000..6db9020f4a99c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseTableAuditingPolicyListResult.java @@ -0,0 +1,27 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseTableAuditingPolicyListResultInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseTableAuditingPolicyInner; +import java.util.List; + +/** + * Type representing DatabaseTableAuditingPolicyListResult. + */ +public interface DatabaseTableAuditingPolicyListResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsage.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsage.java new file mode 100644 index 0000000000000..e4b81517f8ac3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsage.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseUsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing DatabaseUsage. + */ +public interface DatabaseUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nextResetTime value. + */ + DateTime nextResetTime(); + + /** + * @return the resourceName value. + */ + String resourceName(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsages.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsages.java new file mode 100644 index 0000000000000..a829ae8f14475 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUsages.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseUsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseUsages. + */ +public interface DatabaseUsages extends HasInner { + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java index 422206f42f8e1..49215e0a17a2d 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java @@ -13,6 +13,8 @@ import rx.Observable; import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabasesInner; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerMetric; +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerMetricDefinition; /** * Type representing Databases. @@ -148,4 +150,27 @@ public interface Databases extends SupportsCreating importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters); + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter); + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName); + } diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerAdvisor.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerAdvisor.java new file mode 100644 index 0000000000000..9a97b9a2a222b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerAdvisor.java @@ -0,0 +1,136 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.AdvisorInner; +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.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing DatabasisServerAdvisor. + */ +public interface DatabasisServerAdvisor extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the advisorStatus value. + */ + AdvisorStatus advisorStatus(); + + /** + * @return the autoExecuteValue value. + */ + AutoExecuteStatus autoExecuteValue(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the lastChecked value. + */ + DateTime lastChecked(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recommendationsStatus value. + */ + String recommendationsStatus(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabasisServerAdvisor definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithAutoExecuteValue, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabasisServerAdvisor definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabasisServerAdvisor definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasisserveradvisor definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithAutoExecuteValue withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasisserveradvisor definition allowing to specify AutoExecuteValue. + */ + interface WithAutoExecuteValue { + /** + * Specifies autoExecuteValue. + */ + WithCreate withAutoExecuteValue(AutoExecuteStatus autoExecuteValue); + } + + /** + * 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 { + } + } + /** + * The template for a DatabasisServerAdvisor update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoExecuteValue { + } + + /** + * Grouping of DatabasisServerAdvisor update stages. + */ + interface UpdateStages { + /** + * The stage of the databasisserveradvisor update allowing to specify AutoExecuteValue. + */ + interface WithAutoExecuteValue { + /** + * Specifies autoExecuteValue. + */ + Update withAutoExecuteValue(AutoExecuteStatus autoExecuteValue); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetric.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetric.java new file mode 100644 index 0000000000000..4c6acac0324b0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetric.java @@ -0,0 +1,52 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing DatabasisServerMetric. + */ +public interface DatabasisServerMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetricDefinition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetricDefinition.java new file mode 100644 index 0000000000000..9f5c705b4ab53 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabasisServerMetricDefinition.java @@ -0,0 +1,46 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import java.util.List; + +/** + * Type representing DatabasisServerMetricDefinition. + */ +public interface DatabasisServerMetricDefinition extends HasInner, HasManager { + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * @return the unit value. + */ + UnitDefinitionType unit(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfiguration.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfiguration.java new file mode 100644 index 0000000000000..0231211657dfd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfiguration.java @@ -0,0 +1,75 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DisasterRecoveryConfigurationInner; + +/** + * Type representing DisasterRecoveryConfiguration. + */ +public interface DisasterRecoveryConfiguration extends HasInner, HasManager { + /** + * @return the autoFailover value. + */ + DisasterRecoveryConfigurationAutoFailover autoFailover(); + + /** + * @return the failoverPolicy value. + */ + DisasterRecoveryConfigurationFailoverPolicy failoverPolicy(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the logicalServerName value. + */ + String logicalServerName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerLogicalServerName value. + */ + String partnerLogicalServerName(); + + /** + * @return the partnerServerId value. + */ + String partnerServerId(); + + /** + * @return the role value. + */ + DisasterRecoveryConfigurationRole role(); + + /** + * @return the status value. + */ + DisasterRecoveryConfigurationStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationAutoFailover.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationAutoFailover.java new file mode 100644 index 0000000000000..fb178d4668104 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationAutoFailover.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DisasterRecoveryConfigurationAutoFailover. + */ +public final class DisasterRecoveryConfigurationAutoFailover extends ExpandableStringEnum { + /** Static value Off for DisasterRecoveryConfigurationAutoFailover. */ + public static final DisasterRecoveryConfigurationAutoFailover OFF = fromString("Off"); + + /** Static value On for DisasterRecoveryConfigurationAutoFailover. */ + public static final DisasterRecoveryConfigurationAutoFailover ON = fromString("On"); + + /** + * Creates or finds a DisasterRecoveryConfigurationAutoFailover from its string representation. + * @param name a name to look for + * @return the corresponding DisasterRecoveryConfigurationAutoFailover + */ + @JsonCreator + public static DisasterRecoveryConfigurationAutoFailover fromString(String name) { + return fromString(name, DisasterRecoveryConfigurationAutoFailover.class); + } + + /** + * @return known DisasterRecoveryConfigurationAutoFailover values + */ + public static Collection values() { + return values(DisasterRecoveryConfigurationAutoFailover.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationFailoverPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationFailoverPolicy.java new file mode 100644 index 0000000000000..3b1264cfec985 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationFailoverPolicy.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DisasterRecoveryConfigurationFailoverPolicy. + */ +public final class DisasterRecoveryConfigurationFailoverPolicy extends ExpandableStringEnum { + /** Static value Manual for DisasterRecoveryConfigurationFailoverPolicy. */ + public static final DisasterRecoveryConfigurationFailoverPolicy MANUAL = fromString("Manual"); + + /** Static value Automatic for DisasterRecoveryConfigurationFailoverPolicy. */ + public static final DisasterRecoveryConfigurationFailoverPolicy AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a DisasterRecoveryConfigurationFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding DisasterRecoveryConfigurationFailoverPolicy + */ + @JsonCreator + public static DisasterRecoveryConfigurationFailoverPolicy fromString(String name) { + return fromString(name, DisasterRecoveryConfigurationFailoverPolicy.class); + } + + /** + * @return known DisasterRecoveryConfigurationFailoverPolicy values + */ + public static Collection values() { + return values(DisasterRecoveryConfigurationFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationRole.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationRole.java new file mode 100644 index 0000000000000..d75c5bea5320b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationRole.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DisasterRecoveryConfigurationRole. + */ +public final class DisasterRecoveryConfigurationRole extends ExpandableStringEnum { + /** Static value None for DisasterRecoveryConfigurationRole. */ + public static final DisasterRecoveryConfigurationRole NONE = fromString("None"); + + /** Static value Primary for DisasterRecoveryConfigurationRole. */ + public static final DisasterRecoveryConfigurationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for DisasterRecoveryConfigurationRole. */ + public static final DisasterRecoveryConfigurationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a DisasterRecoveryConfigurationRole from its string representation. + * @param name a name to look for + * @return the corresponding DisasterRecoveryConfigurationRole + */ + @JsonCreator + public static DisasterRecoveryConfigurationRole fromString(String name) { + return fromString(name, DisasterRecoveryConfigurationRole.class); + } + + /** + * @return known DisasterRecoveryConfigurationRole values + */ + public static Collection values() { + return values(DisasterRecoveryConfigurationRole.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationStatus.java new file mode 100644 index 0000000000000..0de31ebfac067 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurationStatus.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DisasterRecoveryConfigurationStatus. + */ +public final class DisasterRecoveryConfigurationStatus extends ExpandableStringEnum { + /** Static value Creating for DisasterRecoveryConfigurationStatus. */ + public static final DisasterRecoveryConfigurationStatus CREATING = fromString("Creating"); + + /** Static value Ready for DisasterRecoveryConfigurationStatus. */ + public static final DisasterRecoveryConfigurationStatus READY = fromString("Ready"); + + /** Static value FailingOver for DisasterRecoveryConfigurationStatus. */ + public static final DisasterRecoveryConfigurationStatus FAILING_OVER = fromString("FailingOver"); + + /** Static value Dropping for DisasterRecoveryConfigurationStatus. */ + public static final DisasterRecoveryConfigurationStatus DROPPING = fromString("Dropping"); + + /** + * Creates or finds a DisasterRecoveryConfigurationStatus from its string representation. + * @param name a name to look for + * @return the corresponding DisasterRecoveryConfigurationStatus + */ + @JsonCreator + public static DisasterRecoveryConfigurationStatus fromString(String name) { + return fromString(name, DisasterRecoveryConfigurationStatus.class); + } + + /** + * @return known DisasterRecoveryConfigurationStatus values + */ + public static Collection values() { + return values(DisasterRecoveryConfigurationStatus.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurations.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurations.java new file mode 100644 index 0000000000000..5b53385255fb5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DisasterRecoveryConfigurations.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.v2014_04_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DisasterRecoveryConfigurationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DisasterRecoveryConfigurations. + */ +public interface DisasterRecoveryConfigurations extends HasInner { + /** + * Lists a server's disaster recovery configuration. + * + * @param resourceGroupName The 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 listAsync(String resourceGroupName, String serverName); + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName); + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName); + + /** + * Gets a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName); + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/EditionCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/EditionCapability.java new file mode 100644 index 0000000000000..c68a018c2995c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/EditionCapability.java @@ -0,0 +1,79 @@ +/** + * 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.v2014_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The database edition capabilities. + */ +public class EditionCapability { + /** + * The edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The status of the edition. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The list of supported service objectives for the edition. + */ + @JsonProperty(value = "supportedServiceLevelObjectives", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServiceLevelObjectives; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * Get the edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the status of the edition. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the list of supported service objectives for the edition. + * + * @return the supportedServiceLevelObjectives value + */ + public List supportedServiceLevelObjectives() { + return this.supportedServiceLevelObjectives; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDtuCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDtuCapability.java new file mode 100644 index 0000000000000..0506bea44fe79 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDtuCapability.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.v2014_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Elastic Pool DTU capability. + */ +public class ElasticPoolDtuCapability { + /** + * The maximum size of the database (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Long limit; + + /** + * The maximum number of databases supported. + */ + @JsonProperty(value = "maxDatabaseCount", access = JsonProperty.Access.WRITE_ONLY) + private Long maxDatabaseCount; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The list of supported max sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The included (free) max size for this service level objective. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * The list of supported max database sizes. + */ + @JsonProperty(value = "supportedPerDatabaseMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxSizes; + + /** + * The list of supported max database DTUs. + */ + @JsonProperty(value = "supportedPerDatabaseMaxDtus", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxDtus; + + /** + * Get the maximum size of the database (see 'unit' for the units). + * + * @return the limit value + */ + public Long limit() { + return this.limit; + } + + /** + * Get the maximum number of databases supported. + * + * @return the maxDatabaseCount value + */ + public Long maxDatabaseCount() { + return this.maxDatabaseCount; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the list of supported max sizes. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the included (free) max size for this service level objective. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the list of supported max database sizes. + * + * @return the supportedPerDatabaseMaxSizes value + */ + public List supportedPerDatabaseMaxSizes() { + return this.supportedPerDatabaseMaxSizes; + } + + /** + * Get the list of supported max database DTUs. + * + * @return the supportedPerDatabaseMaxDtus value + */ + public List supportedPerDatabaseMaxDtus() { + return this.supportedPerDatabaseMaxDtus; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEditionCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEditionCapability.java new file mode 100644 index 0000000000000..22f706cf6c314 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEditionCapability.java @@ -0,0 +1,79 @@ +/** + * 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.v2014_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The elastic pool edition capabilities. + */ +public class ElasticPoolEditionCapability { + /** + * The elastic pool edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The status of the elastic pool edition. Possible values include: + * 'Visible', 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The list of supported elastic pool DTU levels for the edition. + */ + @JsonProperty(value = "supportedElasticPoolDtus", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolDtus; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * Get the elastic pool edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the status of the elastic pool edition. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the list of supported elastic pool DTU levels for the edition. + * + * @return the supportedElasticPoolDtus value + */ + public List supportedElasticPoolDtus() { + return this.supportedElasticPoolDtus; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMaxDtuCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMaxDtuCapability.java new file mode 100644 index 0000000000000..2913c51a8d389 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMaxDtuCapability.java @@ -0,0 +1,64 @@ +/** + * 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.v2014_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The max per-database DTU capability. + */ +public class ElasticPoolPerDatabaseMaxDtuCapability { + /** + * The maximum DTUs per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Long limit; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The list of supported min database DTUs. + */ + @JsonProperty(value = "supportedPerDatabaseMinDtus", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMinDtus; + + /** + * Get the maximum DTUs per database. + * + * @return the limit value + */ + public Long limit() { + return this.limit; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the list of supported min database DTUs. + * + * @return the supportedPerDatabaseMinDtus value + */ + public List supportedPerDatabaseMinDtus() { + return this.supportedPerDatabaseMinDtus; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMinDtuCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMinDtuCapability.java new file mode 100644 index 0000000000000..12b7a27305599 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolPerDatabaseMinDtuCapability.java @@ -0,0 +1,48 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The minimum per-database DTU capability. + */ +public class ElasticPoolPerDatabaseMinDtuCapability { + /** + * The maximum DTUs per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Long limit; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * Get the maximum DTUs per database. + * + * @return the limit value + */ + public Long limit() { + return this.limit; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetric.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetric.java new file mode 100644 index 0000000000000..3610a0689a33e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetric.java @@ -0,0 +1,52 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ElasticPoolServerMetric. + */ +public interface ElasticPoolServerMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetricDefinition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetricDefinition.java new file mode 100644 index 0000000000000..5f72ef1807345 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolServerMetricDefinition.java @@ -0,0 +1,46 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import java.util.List; + +/** + * Type representing ElasticPoolServerMetricDefinition. + */ +public interface ElasticPoolServerMetricDefinition extends HasInner, HasManager { + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * @return the unit value. + */ + UnitDefinitionType unit(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java index 31fb76a3a1b0a..2606239a0130a 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java @@ -13,6 +13,8 @@ import rx.Observable; import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolsInner; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolServerMetric; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolServerMetricDefinition; /** * Type representing ElasticPools. @@ -50,4 +52,27 @@ public interface ElasticPools extends SupportsCreating listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter); + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName); + } diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Extensions.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Extensions.java new file mode 100644 index 0000000000000..e9930ea24412e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Extensions.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.v2014_04_01; + +import rx.Completable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ExtensionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Extensions. + */ +public interface Extensions extends HasInner { + /** + * Gets database extensions. + * + * @param resourceGroupName The 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 import into + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicies.java new file mode 100644 index 0000000000000..fbe04d31170db --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicies.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.GeoBackupPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GeoBackupPolicies. + */ +public interface GeoBackupPolicies extends SupportsCreating, HasInner { + /** + * Gets a geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns a list of geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicy.java new file mode 100644 index 0000000000000..7fed72971ef30 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicy.java @@ -0,0 +1,125 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.GeoBackupPolicyInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing GeoBackupPolicy. + */ +public interface GeoBackupPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + GeoBackupPolicyState state(); + + /** + * @return the storageType value. + */ + String storageType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the GeoBackupPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of GeoBackupPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a GeoBackupPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the geobackuppolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the geobackuppolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(GeoBackupPolicyState state); + } + + /** + * 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 { + } + } + /** + * The template for a GeoBackupPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithState { + } + + /** + * Grouping of GeoBackupPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the geobackuppolicy update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + Update withState(GeoBackupPolicyState state); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicyState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicyState.java new file mode 100644 index 0000000000000..f50a498c34f73 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/GeoBackupPolicyState.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for GeoBackupPolicyState. + */ +public enum GeoBackupPolicyState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a GeoBackupPolicyState instance. */ + private String value; + + GeoBackupPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GeoBackupPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed GeoBackupPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static GeoBackupPolicyState fromString(String value) { + GeoBackupPolicyState[] items = GeoBackupPolicyState.values(); + for (GeoBackupPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/LocationCapabilities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/LocationCapabilities.java new file mode 100644 index 0000000000000..74a2a3339bdcd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/LocationCapabilities.java @@ -0,0 +1,36 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.LocationCapabilitiesInner; +import java.util.List; + +/** + * Type representing LocationCapabilities. + */ +public interface LocationCapabilities extends HasInner, HasManager { + /** + * @return the name value. + */ + String name(); + + /** + * @return the status value. + */ + CapabilityStatus status(); + + /** + * @return the supportedServerVersions value. + */ + List supportedServerVersions(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeCapability.java new file mode 100644 index 0000000000000..391c65cb0d487 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeCapability.java @@ -0,0 +1,64 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The maximum size limits for a database. + */ +public class MaxSizeCapability { + /** + * The maximum size of the database (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private long limit; + + /** + * The units that the limit is expressed in. Possible values include: + * 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeUnits unit; + + /** + * The status of the maximum size capability. Possible values include: + * 'Visible', 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * Get the maximum size of the database (see 'unit' for the units). + * + * @return the limit value + */ + public long limit() { + return this.limit; + } + + /** + * Get the units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + * + * @return the unit value + */ + public MaxSizeUnits unit() { + return this.unit; + } + + /** + * Get the status of the maximum size capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeUnits.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeUnits.java new file mode 100644 index 0000000000000..89161b84a1a20 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MaxSizeUnits.java @@ -0,0 +1,59 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for MaxSizeUnits. + */ +public enum MaxSizeUnits { + /** Enum value Megabytes. */ + MEGABYTES("Megabytes"), + + /** Enum value Gigabytes. */ + GIGABYTES("Gigabytes"), + + /** Enum value Terabytes. */ + TERABYTES("Terabytes"), + + /** Enum value Petabytes. */ + PETABYTES("Petabytes"); + + /** The actual serialized value for a MaxSizeUnits instance. */ + private String value; + + MaxSizeUnits(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MaxSizeUnits instance. + * + * @param value the serialized value to parse. + * @return the parsed MaxSizeUnits object, or null if unable to parse. + */ + @JsonCreator + public static MaxSizeUnits fromString(String value) { + MaxSizeUnits[] items = MaxSizeUnits.values(); + for (MaxSizeUnits item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricAvailability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricAvailability.java new file mode 100644 index 0000000000000..8ccb729040c57 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricAvailability.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A metric availability value. + */ +public class MetricAvailability { + /** + * The length of retention for the database metric. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /** + * The granularity of the database metric. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * Get the length of retention for the database metric. + * + * @return the retention value + */ + public String retention() { + return this.retention; + } + + /** + * Get the granularity of the database metric. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricName.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricName.java new file mode 100644 index 0000000000000..8cca4370e35de --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricName.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database metric name. + */ +public class MetricName { + /** + * The name of the database metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * The friendly name of the database metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the name of the database metric. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Get the friendly name of the database metric. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricValue.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricValue.java new file mode 100644 index 0000000000000..4eda2dd673118 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/MetricValue.java @@ -0,0 +1,108 @@ +/** + * 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.v2014_04_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents database metrics. + */ +public class MetricValue { + /** + * The number of values for the metric. + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Double count; + + /** + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /** + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /** + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /** + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** + * Get the number of values for the metric. + * + * @return the count value + */ + public Double count() { + return this.count; + } + + /** + * Get the average value of the metric. + * + * @return the average value + */ + public Double average() { + return this.average; + } + + /** + * Get the max value of the metric. + * + * @return the maximum value + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the min value of the metric. + * + * @return the minimum value + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the metric timestamp (ISO-8601 format). + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total value of the metric. + * + * @return the total value + */ + public Double total() { + return this.total; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationDisplay.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationDisplay.java new file mode 100644 index 0000000000000..17d69550f43e9 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationDisplay.java @@ -0,0 +1,95 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft SQL Database. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Server, Database, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get service provider: Microsoft SQL Database. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft SQL Database. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Server, Database, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Server, Database, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get type of operation: get, read, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set type of operation: get, read, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationListResult.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationListResult.java new file mode 100644 index 0000000000000..e856a3cbf4f55 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationListResult.java @@ -0,0 +1,32 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.OperationListResultInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.OperationInner; +import java.util.List; + +/** + * Type representing OperationListResult. + */ +public interface OperationListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Operations.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Operations.java new file mode 100644 index 0000000000000..080394761796d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PerformanceLevelUnit.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PerformanceLevelUnit.java new file mode 100644 index 0000000000000..34c7636edc730 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PerformanceLevelUnit.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PerformanceLevelUnit. + */ +public enum PerformanceLevelUnit { + /** Enum value DTU. */ + DTU("DTU"); + + /** The actual serialized value for a PerformanceLevelUnit instance. */ + private String value; + + PerformanceLevelUnit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PerformanceLevelUnit instance. + * + * @param value the serialized value to parse. + * @return the parsed PerformanceLevelUnit object, or null if unable to parse. + */ + @JsonCreator + public static PerformanceLevelUnit fromString(String value) { + PerformanceLevelUnit[] items = PerformanceLevelUnit.values(); + for (PerformanceLevelUnit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PrimaryAggregationType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PrimaryAggregationType.java new file mode 100644 index 0000000000000..ec19ea5224ac7 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/PrimaryAggregationType.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PrimaryAggregationType. + */ +public final class PrimaryAggregationType extends ExpandableStringEnum { + /** Static value None for PrimaryAggregationType. */ + public static final PrimaryAggregationType NONE = fromString("None"); + + /** Static value Average for PrimaryAggregationType. */ + public static final PrimaryAggregationType AVERAGE = fromString("Average"); + + /** Static value Count for PrimaryAggregationType. */ + public static final PrimaryAggregationType COUNT = fromString("Count"); + + /** Static value Minimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMUM = fromString("Minimum"); + + /** Static value Maximum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Total for PrimaryAggregationType. */ + public static final PrimaryAggregationType TOTAL = fromString("Total"); + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * @param name a name to look for + * @return the corresponding PrimaryAggregationType + */ + @JsonCreator + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** + * @return known PrimaryAggregationType values + */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Queries.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Queries.java new file mode 100644 index 0000000000000..1248b0575e885 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Queries.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.QueriesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Queries. + */ +public interface Queries extends HasInner { + /** + * Gets a list of top queries by 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryAggregationFunction.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryAggregationFunction.java new file mode 100644 index 0000000000000..7e92c8f9fcdea --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryAggregationFunction.java @@ -0,0 +1,59 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for QueryAggregationFunction. + */ +public enum QueryAggregationFunction { + /** Enum value min. */ + MIN("min"), + + /** Enum value max. */ + MAX("max"), + + /** Enum value avg. */ + AVG("avg"), + + /** Enum value sum. */ + SUM("sum"); + + /** The actual serialized value for a QueryAggregationFunction instance. */ + private String value; + + QueryAggregationFunction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a QueryAggregationFunction instance. + * + * @param value the serialized value to parse. + * @return the parsed QueryAggregationFunction object, or null if unable to parse. + */ + @JsonCreator + public static QueryAggregationFunction fromString(String value) { + QueryAggregationFunction[] items = QueryAggregationFunction.values(); + for (QueryAggregationFunction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryExecutionType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryExecutionType.java new file mode 100644 index 0000000000000..15450c2be26f0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryExecutionType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for QueryExecutionType. + */ +public enum QueryExecutionType { + /** Enum value any. */ + ANY("any"), + + /** Enum value regular. */ + REGULAR("regular"), + + /** Enum value irregular. */ + IRREGULAR("irregular"), + + /** Enum value aborted. */ + ABORTED("aborted"), + + /** Enum value exception. */ + EXCEPTION("exception"); + + /** The actual serialized value for a QueryExecutionType instance. */ + private String value; + + QueryExecutionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a QueryExecutionType instance. + * + * @param value the serialized value to parse. + * @return the parsed QueryExecutionType object, or null if unable to parse. + */ + @JsonCreator + public static QueryExecutionType fromString(String value) { + QueryExecutionType[] items = QueryExecutionType.values(); + for (QueryExecutionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryInterval.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryInterval.java new file mode 100644 index 0000000000000..180b99ab139c1 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryInterval.java @@ -0,0 +1,64 @@ +/** + * 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.v2014_04_01; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database query. + */ +public class QueryInterval { + /** + * The start time of the measurement interval (ISO8601 format). + */ + @JsonProperty(value = "intervalStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime intervalStartTime; + + /** + * The number of times the query was executed during this interval. + */ + @JsonProperty(value = "executionCount", access = JsonProperty.Access.WRITE_ONLY) + private Double executionCount; + + /** + * The list of query metrics during this interval. + */ + @JsonProperty(value = "metrics", access = JsonProperty.Access.WRITE_ONLY) + private List metrics; + + /** + * Get the start time of the measurement interval (ISO8601 format). + * + * @return the intervalStartTime value + */ + public DateTime intervalStartTime() { + return this.intervalStartTime; + } + + /** + * Get the number of times the query was executed during this interval. + * + * @return the executionCount value + */ + public Double executionCount() { + return this.executionCount; + } + + /** + * Get the list of query metrics during this interval. + * + * @return the metrics value + */ + public List metrics() { + return this.metrics; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetric.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetric.java new file mode 100644 index 0000000000000..085c40d0a4f91 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetric.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database query. + */ +public class QueryMetric { + /** + * The name of the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The name of the metric for display in user interface. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The unit of measurement. Possible values include: 'percentage', 'KB', + * 'microseconds'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private QueryMetricUnit unit; + + /** + * The measured value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /** + * Get the name of the metric. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the name of the metric for display in user interface. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the unit of measurement. Possible values include: 'percentage', 'KB', 'microseconds'. + * + * @return the unit value + */ + public QueryMetricUnit unit() { + return this.unit; + } + + /** + * Get the measured value. + * + * @return the value value + */ + public Double value() { + return this.value; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetricUnit.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetricUnit.java new file mode 100644 index 0000000000000..9c28262c44eb4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryMetricUnit.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for QueryMetricUnit. + */ +public enum QueryMetricUnit { + /** Enum value percentage. */ + PERCENTAGE("percentage"), + + /** Enum value KB. */ + KB("KB"), + + /** Enum value microseconds. */ + MICROSECONDS("microseconds"); + + /** The actual serialized value for a QueryMetricUnit instance. */ + private String value; + + QueryMetricUnit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a QueryMetricUnit instance. + * + * @param value the serialized value to parse. + * @return the parsed QueryMetricUnit object, or null if unable to parse. + */ + @JsonCreator + public static QueryMetricUnit fromString(String value) { + QueryMetricUnit[] items = QueryMetricUnit.values(); + for (QueryMetricUnit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryObservedMetricType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryObservedMetricType.java new file mode 100644 index 0000000000000..d298a8633ebb5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryObservedMetricType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for QueryObservedMetricType. + */ +public enum QueryObservedMetricType { + /** Enum value cpu. */ + CPU("cpu"), + + /** Enum value io. */ + IO("io"), + + /** Enum value logio. */ + LOGIO("logio"), + + /** Enum value duration. */ + DURATION("duration"), + + /** Enum value executionCount. */ + EXECUTION_COUNT("executionCount"); + + /** The actual serialized value for a QueryObservedMetricType instance. */ + private String value; + + QueryObservedMetricType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a QueryObservedMetricType instance. + * + * @param value the serialized value to parse. + * @return the parsed QueryObservedMetricType object, or null if unable to parse. + */ + @JsonCreator + public static QueryObservedMetricType fromString(String value) { + QueryObservedMetricType[] items = QueryObservedMetricType.values(); + for (QueryObservedMetricType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistic.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistic.java new file mode 100644 index 0000000000000..0b77d33466264 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistic.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.QueryStatisticInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import java.util.List; + +/** + * Type representing QueryStatistic. + */ +public interface QueryStatistic extends HasInner, HasManager { + /** + * @return the intervals value. + */ + List intervals(); + + /** + * @return the queryId value. + */ + String queryId(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistics.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistics.java new file mode 100644 index 0000000000000..44b7e99e1eb45 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryStatistics.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.QueryStatisticsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing QueryStatistics. + */ +public interface QueryStatistics extends HasInner { + /** + * Lists a query's statistics. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryText.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryText.java new file mode 100644 index 0000000000000..b0bf78819f95a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryText.java @@ -0,0 +1,35 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.QueryTextInner; + +/** + * Type representing QueryText. + */ +public interface QueryText extends HasInner, HasManager { + /** + * @return the name value. + */ + String name(); + + /** + * @return the queryText value. + */ + String queryText(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryTexts.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryTexts.java new file mode 100644 index 0000000000000..3fc47514262cc --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/QueryTexts.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.QueryTextsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing QueryTexts. + */ +public interface QueryTexts extends HasInner { + /** + * Gets a query's text. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabase.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabase.java new file mode 100644 index 0000000000000..7d15281944cb8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabase.java @@ -0,0 +1,58 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecoverableDatabaseInner; +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.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RecoverableDatabase. + */ +public interface RecoverableDatabase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the edition value. + */ + String edition(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastAvailableBackupDate value. + */ + DateTime lastAvailableBackupDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabases.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabases.java new file mode 100644 index 0000000000000..c499851352470 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecoverableDatabases.java @@ -0,0 +1,40 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecoverableDatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecoverableDatabases. + */ +public interface RecoverableDatabases extends HasInner { + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @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 serverName, String databaseName); + + /** + * Gets a list of recoverable 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabase.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabase.java new file mode 100644 index 0000000000000..121b7883295af --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabase.java @@ -0,0 +1,83 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RestorableDroppedDatabaseInner; +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.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RestorableDroppedDatabase. + */ +public interface RestorableDroppedDatabase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the deletionDate value. + */ + DateTime deletionDate(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the edition value. + */ + String edition(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeBytes value. + */ + String maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabases.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabases.java new file mode 100644 index 0000000000000..e2a98efbc20f4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorableDroppedDatabases.java @@ -0,0 +1,40 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RestorableDroppedDatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RestorableDroppedDatabases. + */ +public interface RestorableDroppedDatabases extends HasInner { + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId); + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoint.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoint.java new file mode 100644 index 0000000000000..71ddbed941a67 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoint.java @@ -0,0 +1,51 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RestorePointInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RestorePoint. + */ +public interface RestorePoint extends HasInner, HasManager { + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the restorePointCreationDate value. + */ + DateTime restorePointCreationDate(); + + /** + * @return the restorePointType value. + */ + RestorePointType restorePointType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePointType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePointType.java new file mode 100644 index 0000000000000..1848d94ae4d04 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePointType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RestorePointType. + */ +public enum RestorePointType { + /** Enum value DISCRETE. */ + DISCRETE("DISCRETE"), + + /** Enum value CONTINUOUS. */ + CONTINUOUS("CONTINUOUS"); + + /** The actual serialized value for a RestorePointType instance. */ + private String value; + + RestorePointType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestorePointType instance. + * + * @param value the serialized value to parse. + * @return the parsed RestorePointType object, or null if unable to parse. + */ + @JsonCreator + public static RestorePointType fromString(String value) { + RestorePointType[] items = RestorePointType.values(); + for (RestorePointType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoints.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoints.java new file mode 100644 index 0000000000000..a4f04de987e79 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RestorePoints.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RestorePointsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RestorePoints. + */ +public interface RestorePoints extends HasInner { + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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 get available restore points. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Server.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Server.java new file mode 100644 index 0000000000000..c0caf384db21e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Server.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.v2014_04_01; + +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.v2014_04_01.implementation.SqlManager; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerInner; + +/** + * Type representing Server. + */ +public interface Server extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * @return the externalAdministratorLogin value. + */ + String externalAdministratorLogin(); + + /** + * @return the externalAdministratorSid value. + */ + UUID externalAdministratorSid(); + + /** + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the state value. + */ + ServerState state(); + + /** + * @return the version value. + */ + ServerVersion version(); + + /** + * The entirety of the Server definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Server definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Server definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Server definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the server update allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the server update allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the server update allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + */ + WithCreate withVersion(ServerVersion version); + } + + /** + * 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.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithVersion { + } + } + /** + * The template for a Server update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithVersion { + } + + /** + * Grouping of Server update stages. + */ + interface UpdateStages { + /** + * The stage of the server {0} allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + Update withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the server {0} allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the server {0} allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + */ + Update withVersion(ServerVersion version); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisor.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisor.java new file mode 100644 index 0000000000000..ef0d9500d7a96 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisor.java @@ -0,0 +1,136 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.AdvisorInner; +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.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ServerAdvisor. + */ +public interface ServerAdvisor extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the advisorStatus value. + */ + AdvisorStatus advisorStatus(); + + /** + * @return the autoExecuteValue value. + */ + AutoExecuteStatus autoExecuteValue(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the lastChecked value. + */ + DateTime lastChecked(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recommendationsStatus value. + */ + String recommendationsStatus(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerAdvisor definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithAutoExecuteValue, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerAdvisor definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerAdvisor definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serveradvisor definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithAutoExecuteValue withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serveradvisor definition allowing to specify AutoExecuteValue. + */ + interface WithAutoExecuteValue { + /** + * Specifies autoExecuteValue. + */ + WithCreate withAutoExecuteValue(AutoExecuteStatus autoExecuteValue); + } + + /** + * 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 { + } + } + /** + * The template for a ServerAdvisor update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoExecuteValue { + } + + /** + * Grouping of ServerAdvisor update stages. + */ + interface UpdateStages { + /** + * The stage of the serveradvisor update allowing to specify AutoExecuteValue. + */ + interface WithAutoExecuteValue { + /** + * Specifies autoExecuteValue. + */ + Update withAutoExecuteValue(AutoExecuteStatus autoExecuteValue); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisors.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisors.java new file mode 100644 index 0000000000000..75172b6b65087 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAdvisors.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerAdvisorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerAdvisors. + */ +public interface ServerAdvisors extends SupportsCreating, HasInner { + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String advisorName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrator.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrator.java new file mode 100644 index 0000000000000..671fe9d97b2a8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrator.java @@ -0,0 +1,146 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.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.v2014_04_01.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.WithTenantId, 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. + */ + WithAdministratorType withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify AdministratorType. + */ + interface WithAdministratorType { + /** + * Specifies administratorType. + */ + WithLogin withAdministratorType(String administratorType); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify Login. + */ + interface WithLogin { + /** + * Specifies login. + */ + WithSid withLogin(String login); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify Sid. + */ + interface WithSid { + /** + * Specifies sid. + */ + WithTenantId withSid(UUID sid); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify TenantId. + */ + interface WithTenantId { + /** + * Specifies tenantId. + */ + 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 { + } + } + /** + * The template for a ServerAzureADAdministrator update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ServerAzureADAdministrator update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrators.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrators.java new file mode 100644 index 0000000000000..d76edf44f7f24 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerAzureADAdministrators.java @@ -0,0 +1,51 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerAzureADAdministratorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerAzureADAdministrators. + */ +public interface ServerAzureADAdministrators extends SupportsCreating, HasInner { + /** + * Returns an 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); + + /** + * Returns 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(String resourceGroupName, 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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLink.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLink.java new file mode 100644 index 0000000000000..36a8b13b72c71 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLink.java @@ -0,0 +1,125 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerCommunicationLinkInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing ServerCommunicationLink. + */ +public interface ServerCommunicationLink extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerCommunicationLink definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithPartnerServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerCommunicationLink definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerCommunicationLink definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the servercommunicationlink definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithPartnerServer withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the servercommunicationlink definition allowing to specify PartnerServer. + */ + interface WithPartnerServer { + /** + * Specifies partnerServer. + */ + WithCreate withPartnerServer(String partnerServer); + } + + /** + * 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 { + } + } + /** + * The template for a ServerCommunicationLink update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPartnerServer { + } + + /** + * Grouping of ServerCommunicationLink update stages. + */ + interface UpdateStages { + /** + * The stage of the servercommunicationlink update allowing to specify PartnerServer. + */ + interface WithPartnerServer { + /** + * Specifies partnerServer. + */ + Update withPartnerServer(String partnerServer); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLinks.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLinks.java new file mode 100644 index 0000000000000..ea88ac33e1947 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerCommunicationLinks.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerCommunicationLinksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerCommunicationLinks. + */ +public interface ServerCommunicationLinks extends SupportsCreating, HasInner { + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String communicationLinkName); + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String communicationLinkName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicies.java new file mode 100644 index 0000000000000..b8635588e5369 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicies.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerConnectionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerConnectionPolicies. + */ +public interface ServerConnectionPolicies extends SupportsCreating, HasInner { + /** + * Gets the server's secure connection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicy.java new file mode 100644 index 0000000000000..c54087904a34a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionPolicy.java @@ -0,0 +1,120 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerConnectionPolicyInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing ServerConnectionPolicy. + */ +public interface ServerConnectionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the connectionType value. + */ + ServerConnectionType connectionType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerConnectionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithConnectionType, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerConnectionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerConnectionPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverconnectionpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithConnectionType withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverconnectionpolicy definition allowing to specify ConnectionType. + */ + interface WithConnectionType { + /** + * Specifies connectionType. + */ + WithCreate withConnectionType(ServerConnectionType connectionType); + } + + /** + * 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 { + } + } + /** + * The template for a ServerConnectionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithConnectionType { + } + + /** + * Grouping of ServerConnectionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the serverconnectionpolicy update allowing to specify ConnectionType. + */ + interface WithConnectionType { + /** + * Specifies connectionType. + */ + Update withConnectionType(ServerConnectionType connectionType); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionType.java new file mode 100644 index 0000000000000..d8962e1c4d554 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerConnectionType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ServerConnectionType. + */ +public enum ServerConnectionType { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Proxy. */ + PROXY("Proxy"), + + /** Enum value Redirect. */ + REDIRECT("Redirect"); + + /** The actual serialized value for a ServerConnectionType instance. */ + private String value; + + ServerConnectionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServerConnectionType instance. + * + * @param value the serialized value to parse. + * @return the parsed ServerConnectionType object, or null if unable to parse. + */ + @JsonCreator + public static ServerConnectionType fromString(String value) { + ServerConnectionType[] items = ServerConnectionType.values(); + for (ServerConnectionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerState.java new file mode 100644 index 0000000000000..737fa38dc7136 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerState.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ServerState. + */ +public enum ServerState { + /** Enum value Ready. */ + READY("Ready"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ServerState instance. */ + private String value; + + ServerState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServerState instance. + * + * @param value the serialized value to parse. + * @return the parsed ServerState object, or null if unable to parse. + */ + @JsonCreator + public static ServerState fromString(String value) { + ServerState[] items = ServerState.values(); + for (ServerState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java new file mode 100644 index 0000000000000..9570848fe18cf --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java @@ -0,0 +1,40 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerTableAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerTableAuditingPolicies. + */ +public interface ServerTableAuditingPolicies extends SupportsCreating, HasInner { + /** + * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Gets a server's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicy.java new file mode 100644 index 0000000000000..d4e5f9bec8430 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicy.java @@ -0,0 +1,371 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerTableAuditingPolicyInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing ServerTableAuditingPolicy. + */ +public interface ServerTableAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditingState value. + */ + String auditingState(); + + /** + * @return the auditLogsTableName value. + */ + String auditLogsTableName(); + + /** + * @return the eventTypesToAudit value. + */ + String eventTypesToAudit(); + + /** + * @return the fullAuditLogsTableName value. + */ + String fullAuditLogsTableName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + String retentionDays(); + + /** + * @return the storageAccountKey value. + */ + String storageAccountKey(); + + /** + * @return the storageAccountName value. + */ + String storageAccountName(); + + /** + * @return the storageAccountResourceGroupName value. + */ + String storageAccountResourceGroupName(); + + /** + * @return the storageAccountSecondaryKey value. + */ + String storageAccountSecondaryKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageTableEndpoint value. + */ + String storageTableEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerTableAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerTableAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerTableAuditingPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify AuditingState. + */ + interface WithAuditingState { + /** + * Specifies auditingState. + */ + WithCreate withAuditingState(String auditingState); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify AuditLogsTableName. + */ + interface WithAuditLogsTableName { + /** + * Specifies auditLogsTableName. + */ + WithCreate withAuditLogsTableName(String auditLogsTableName); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify EventTypesToAudit. + */ + interface WithEventTypesToAudit { + /** + * Specifies eventTypesToAudit. + */ + WithCreate withEventTypesToAudit(String eventTypesToAudit); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify FullAuditLogsTableName. + */ + interface WithFullAuditLogsTableName { + /** + * Specifies fullAuditLogsTableName. + */ + WithCreate withFullAuditLogsTableName(String fullAuditLogsTableName); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(String retentionDays); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify StorageAccountKey. + */ + interface WithStorageAccountKey { + /** + * Specifies storageAccountKey. + */ + WithCreate withStorageAccountKey(String storageAccountKey); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify StorageAccountName. + */ + interface WithStorageAccountName { + /** + * Specifies storageAccountName. + */ + WithCreate withStorageAccountName(String storageAccountName); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify StorageAccountResourceGroupName. + */ + interface WithStorageAccountResourceGroupName { + /** + * Specifies storageAccountResourceGroupName. + */ + WithCreate withStorageAccountResourceGroupName(String storageAccountResourceGroupName); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify StorageAccountSecondaryKey. + */ + interface WithStorageAccountSecondaryKey { + /** + * Specifies storageAccountSecondaryKey. + */ + WithCreate withStorageAccountSecondaryKey(String storageAccountSecondaryKey); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the servertableauditingpolicy definition allowing to specify StorageTableEndpoint. + */ + interface WithStorageTableEndpoint { + /** + * Specifies storageTableEndpoint. + */ + WithCreate withStorageTableEndpoint(String storageTableEndpoint); + } + + /** + * 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.WithAuditingState, DefinitionStages.WithAuditLogsTableName, DefinitionStages.WithEventTypesToAudit, DefinitionStages.WithFullAuditLogsTableName, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountKey, DefinitionStages.WithStorageAccountName, DefinitionStages.WithStorageAccountResourceGroupName, DefinitionStages.WithStorageAccountSecondaryKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageTableEndpoint { + } + } + /** + * The template for a ServerTableAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditingState, UpdateStages.WithAuditLogsTableName, UpdateStages.WithEventTypesToAudit, UpdateStages.WithFullAuditLogsTableName, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountKey, UpdateStages.WithStorageAccountName, UpdateStages.WithStorageAccountResourceGroupName, UpdateStages.WithStorageAccountSecondaryKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageTableEndpoint { + } + + /** + * Grouping of ServerTableAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the servertableauditingpolicy update allowing to specify AuditingState. + */ + interface WithAuditingState { + /** + * Specifies auditingState. + */ + Update withAuditingState(String auditingState); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify AuditLogsTableName. + */ + interface WithAuditLogsTableName { + /** + * Specifies auditLogsTableName. + */ + Update withAuditLogsTableName(String auditLogsTableName); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify EventTypesToAudit. + */ + interface WithEventTypesToAudit { + /** + * Specifies eventTypesToAudit. + */ + Update withEventTypesToAudit(String eventTypesToAudit); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify FullAuditLogsTableName. + */ + interface WithFullAuditLogsTableName { + /** + * Specifies fullAuditLogsTableName. + */ + Update withFullAuditLogsTableName(String fullAuditLogsTableName); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(String retentionDays); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify StorageAccountKey. + */ + interface WithStorageAccountKey { + /** + * Specifies storageAccountKey. + */ + Update withStorageAccountKey(String storageAccountKey); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify StorageAccountName. + */ + interface WithStorageAccountName { + /** + * Specifies storageAccountName. + */ + Update withStorageAccountName(String storageAccountName); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify StorageAccountResourceGroupName. + */ + interface WithStorageAccountResourceGroupName { + /** + * Specifies storageAccountResourceGroupName. + */ + Update withStorageAccountResourceGroupName(String storageAccountResourceGroupName); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify StorageAccountSecondaryKey. + */ + interface WithStorageAccountSecondaryKey { + /** + * Specifies storageAccountSecondaryKey. + */ + Update withStorageAccountSecondaryKey(String storageAccountSecondaryKey); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the servertableauditingpolicy update allowing to specify StorageTableEndpoint. + */ + interface WithStorageTableEndpoint { + /** + * Specifies storageTableEndpoint. + */ + Update withStorageTableEndpoint(String storageTableEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicyListResult.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicyListResult.java new file mode 100644 index 0000000000000..d1efc1ce3f9b4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicyListResult.java @@ -0,0 +1,27 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerTableAuditingPolicyListResultInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerTableAuditingPolicyInner; +import java.util.List; + +/** + * Type representing ServerTableAuditingPolicyListResult. + */ +public interface ServerTableAuditingPolicyListResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUpdate.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUpdate.java new file mode 100644 index 0000000000000..6f2ed8f5e450a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUpdate.java @@ -0,0 +1,191 @@ +/** + * 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.v2014_04_01; + +import java.util.Map; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents an update to a server. + */ +@JsonFlatten +public class ServerUpdate extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * The version of the server. Possible values include: '2.0', '12.0'. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /** + * Administrator username for the server. Can only be specified when the + * server is being created (and is required for creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The ID of the Active Azure Directory object with admin permissions on + * this server. Legacy parameter, always null. To check for Active + * Directory admin, query .../servers/{serverName}/administrators. + */ + @JsonProperty(value = "properties.externalAdministratorSid", access = JsonProperty.Access.WRITE_ONLY) + private UUID externalAdministratorSid; + + /** + * The display name of the Azure Active Directory object with admin + * permissions on this server. Legacy parameter, always null. To check for + * Active Directory admin, query .../servers/{serverName}/administrators. + */ + @JsonProperty(value = "properties.externalAdministratorLogin", access = JsonProperty.Access.WRITE_ONLY) + private String externalAdministratorLogin; + + /** + * The state of the server. Possible values include: 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ServerState state; + + /** + * 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 ServerUpdate object itself. + */ + public ServerUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the version of the server. Possible values include: '2.0', '12.0'. + * + * @return the version value + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version of the server. Possible values include: '2.0', '12.0'. + * + * @param version the version value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get administrator username for the server. Can only be specified when the server is being created (and is required for creation). + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the server. Can only be specified when the server is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for server creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the ID of the Active Azure Directory object with admin permissions on this server. Legacy parameter, always null. To check for Active Directory admin, query .../servers/{serverName}/administrators. + * + * @return the externalAdministratorSid value + */ + public UUID externalAdministratorSid() { + return this.externalAdministratorSid; + } + + /** + * Get the display name of the Azure Active Directory object with admin permissions on this server. Legacy parameter, always null. To check for Active Directory admin, query .../servers/{serverName}/administrators. + * + * @return the externalAdministratorLogin value + */ + public String externalAdministratorLogin() { + return this.externalAdministratorLogin; + } + + /** + * Get the state of the server. Possible values include: 'Ready', 'Disabled'. + * + * @return the state value + */ + public ServerState state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsage.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsage.java new file mode 100644 index 0000000000000..1346238b69931 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsage.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerUsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ServerUsage. + */ +public interface ServerUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nextResetTime value. + */ + DateTime nextResetTime(); + + /** + * @return the resourceName value. + */ + String resourceName(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsages.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsages.java new file mode 100644 index 0000000000000..f418fc2b446c2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerUsages.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServerUsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerUsages. + */ +public interface ServerUsages extends HasInner { + /** + * Returns server usages. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersion.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersion.java new file mode 100644 index 0000000000000..75e9ff996444a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersion.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServerVersion. + */ +public final class ServerVersion extends ExpandableStringEnum { + /** Static value 2.0 for ServerVersion. */ + public static final ServerVersion TWO_FULL_STOP_ZERO = fromString("2.0"); + + /** Static value 12.0 for ServerVersion. */ + public static final ServerVersion ONE_TWO_FULL_STOP_ZERO = fromString("12.0"); + + /** + * Creates or finds a ServerVersion from its string representation. + * @param name a name to look for + * @return the corresponding ServerVersion + */ + @JsonCreator + public static ServerVersion fromString(String name) { + return fromString(name, ServerVersion.class); + } + + /** + * @return known ServerVersion values + */ + public static Collection values() { + return values(ServerVersion.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersionCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersionCapability.java new file mode 100644 index 0000000000000..99892b49213bf --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerVersionCapability.java @@ -0,0 +1,79 @@ +/** + * 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.v2014_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The server capabilities. + */ +public class ServerVersionCapability { + /** + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The status of the server version. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The list of supported database editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /** + * The list of supported elastic pool editions. + */ + @JsonProperty(value = "supportedElasticPoolEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolEditions; + + /** + * Get the server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the status of the server version. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the list of supported database editions. + * + * @return the supportedEditions value + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the list of supported elastic pool editions. + * + * @return the supportedElasticPoolEditions value + */ + public List supportedElasticPoolEditions() { + return this.supportedElasticPoolEditions; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java index e2d14f49ecc37..7cdc0e81c1e26 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java @@ -8,14 +8,20 @@ package com.microsoft.azure.management.sql.v2014_04_01; +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.v2014_04_01.implementation.ServersInner; import com.microsoft.azure.arm.model.HasInner; /** * Type representing Servers. */ -public interface Servers extends HasInner { +public interface Servers extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { /** * Determines whether a resource can be created with the specified name. * diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjective.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjective.java new file mode 100644 index 0000000000000..e8e83742c4ddd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjective.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceObjectiveInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing ServiceObjective. + */ +public interface ServiceObjective extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the enabled value. + */ + boolean enabled(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isDefault value. + */ + boolean isDefault(); + + /** + * @return the isSystem value. + */ + boolean isSystem(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceObjectiveName value. + */ + String serviceObjectiveName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveCapability.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveCapability.java new file mode 100644 index 0000000000000..ccaededfed286 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveCapability.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.v2014_04_01; + +import java.util.UUID; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The service objectives capability. + */ +@JsonFlatten +public class ServiceObjectiveCapability { + /** + * The service objective name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The status of the service objective. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * Unit type used to measure service objective performance level. Possible + * values include: 'DTU'. + */ + @JsonProperty(value = "performanceLevel.unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * Performance level value. + */ + @JsonProperty(value = "performanceLevel.value", access = JsonProperty.Access.WRITE_ONLY) + private Integer value; + + /** + * The unique ID of the service objective. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private UUID id; + + /** + * The list of supported maximum database sizes for this service objective. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The included (free) max size for this service level objective. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * Get the service objective name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the status of the service objective. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get unit type used to measure service objective performance level. Possible values include: 'DTU'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get performance level value. + * + * @return the value value + */ + public Integer value() { + return this.value; + } + + /** + * Get the unique ID of the service objective. + * + * @return the id value + */ + public UUID id() { + return this.id; + } + + /** + * Get the list of supported maximum database sizes for this service objective. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the included (free) max size for this service level objective. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectives.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectives.java new file mode 100644 index 0000000000000..c7e2566437e83 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectives.java @@ -0,0 +1,40 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceObjectivesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServiceObjectives. + */ +public interface ServiceObjectives extends HasInner { + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String serviceObjectiveName); + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TableAuditingPolicyProperties.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TableAuditingPolicyProperties.java new file mode 100644 index 0000000000000..d3c966dc7ceeb --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TableAuditingPolicyProperties.java @@ -0,0 +1,304 @@ +/** + * 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.v2014_04_01; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a table auditing policy. + */ +public class TableAuditingPolicyProperties { + /** + * The state of the policy. + */ + @JsonProperty(value = "auditingState") + private String auditingState; + + /** + * The audit logs table name. + */ + @JsonProperty(value = "auditLogsTableName") + private String auditLogsTableName; + + /** + * Comma-separated list of event types to audit. + */ + @JsonProperty(value = "eventTypesToAudit") + private String eventTypesToAudit; + + /** + * The full audit logs table name. + */ + @JsonProperty(value = "fullAuditLogsTableName") + private String fullAuditLogsTableName; + + /** + * The number of days to keep in the audit logs. + */ + @JsonProperty(value = "retentionDays") + private String retentionDays; + + /** + * The key of the auditing storage account. + */ + @JsonProperty(value = "storageAccountKey") + private String storageAccountKey; + + /** + * The table storage account name. + */ + @JsonProperty(value = "storageAccountName") + private String storageAccountName; + + /** + * The table storage account resource group name. + */ + @JsonProperty(value = "storageAccountResourceGroupName") + private String storageAccountResourceGroupName; + + /** + * The secondary key of the auditing storage account. + */ + @JsonProperty(value = "storageAccountSecondaryKey") + private String storageAccountSecondaryKey; + + /** + * The table storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * The storage table endpoint. + */ + @JsonProperty(value = "storageTableEndpoint") + private String storageTableEndpoint; + + /** + * Get the state of the policy. + * + * @return the auditingState value + */ + public String auditingState() { + return this.auditingState; + } + + /** + * Set the state of the policy. + * + * @param auditingState the auditingState value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withAuditingState(String auditingState) { + this.auditingState = auditingState; + return this; + } + + /** + * Get the audit logs table name. + * + * @return the auditLogsTableName value + */ + public String auditLogsTableName() { + return this.auditLogsTableName; + } + + /** + * Set the audit logs table name. + * + * @param auditLogsTableName the auditLogsTableName value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withAuditLogsTableName(String auditLogsTableName) { + this.auditLogsTableName = auditLogsTableName; + return this; + } + + /** + * Get comma-separated list of event types to audit. + * + * @return the eventTypesToAudit value + */ + public String eventTypesToAudit() { + return this.eventTypesToAudit; + } + + /** + * Set comma-separated list of event types to audit. + * + * @param eventTypesToAudit the eventTypesToAudit value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withEventTypesToAudit(String eventTypesToAudit) { + this.eventTypesToAudit = eventTypesToAudit; + return this; + } + + /** + * Get the full audit logs table name. + * + * @return the fullAuditLogsTableName value + */ + public String fullAuditLogsTableName() { + return this.fullAuditLogsTableName; + } + + /** + * Set the full audit logs table name. + * + * @param fullAuditLogsTableName the fullAuditLogsTableName value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withFullAuditLogsTableName(String fullAuditLogsTableName) { + this.fullAuditLogsTableName = fullAuditLogsTableName; + return this; + } + + /** + * Get the number of days to keep in the audit logs. + * + * @return the retentionDays value + */ + public String retentionDays() { + return this.retentionDays; + } + + /** + * Set the number of days to keep in the audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withRetentionDays(String retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the key of the auditing storage account. + * + * @return the storageAccountKey value + */ + public String storageAccountKey() { + return this.storageAccountKey; + } + + /** + * Set the key of the auditing storage account. + * + * @param storageAccountKey the storageAccountKey value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withStorageAccountKey(String storageAccountKey) { + this.storageAccountKey = storageAccountKey; + return this; + } + + /** + * Get the table storage account name. + * + * @return the storageAccountName value + */ + public String storageAccountName() { + return this.storageAccountName; + } + + /** + * Set the table storage account name. + * + * @param storageAccountName the storageAccountName value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withStorageAccountName(String storageAccountName) { + this.storageAccountName = storageAccountName; + return this; + } + + /** + * Get the table storage account resource group name. + * + * @return the storageAccountResourceGroupName value + */ + public String storageAccountResourceGroupName() { + return this.storageAccountResourceGroupName; + } + + /** + * Set the table storage account resource group name. + * + * @param storageAccountResourceGroupName the storageAccountResourceGroupName value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withStorageAccountResourceGroupName(String storageAccountResourceGroupName) { + this.storageAccountResourceGroupName = storageAccountResourceGroupName; + return this; + } + + /** + * Get the secondary key of the auditing storage account. + * + * @return the storageAccountSecondaryKey value + */ + public String storageAccountSecondaryKey() { + return this.storageAccountSecondaryKey; + } + + /** + * Set the secondary key of the auditing storage account. + * + * @param storageAccountSecondaryKey the storageAccountSecondaryKey value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withStorageAccountSecondaryKey(String storageAccountSecondaryKey) { + this.storageAccountSecondaryKey = storageAccountSecondaryKey; + return this; + } + + /** + * Get the table storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the table storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get the storage table endpoint. + * + * @return the storageTableEndpoint value + */ + public String storageTableEndpoint() { + return this.storageTableEndpoint; + } + + /** + * Set the storage table endpoint. + * + * @param storageTableEndpoint the storageTableEndpoint value to set + * @return the TableAuditingPolicyProperties object itself. + */ + public TableAuditingPolicyProperties withStorageTableEndpoint(String storageTableEndpoint) { + this.storageTableEndpoint = storageTableEndpoint; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TopQueries.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TopQueries.java new file mode 100644 index 0000000000000..40cf4e5302ef8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TopQueries.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TopQueriesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing TopQueries. + */ +public interface TopQueries extends HasInner, HasManager { + /** + * @return the aggregationFunction value. + */ + QueryAggregationFunction aggregationFunction(); + + /** + * @return the executionType value. + */ + QueryExecutionType executionType(); + + /** + * @return the intervalType value. + */ + String intervalType(); + + /** + * @return the numberOfTopQueries value. + */ + Double numberOfTopQueries(); + + /** + * @return the observationEndTime value. + */ + DateTime observationEndTime(); + + /** + * @return the observationStartTime value. + */ + DateTime observationStartTime(); + + /** + * @return the observedMetric value. + */ + QueryObservedMetricType observedMetric(); + + /** + * @return the queries value. + */ + List queries(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionConfigurations.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionConfigurations.java new file mode 100644 index 0000000000000..a7f9553b4f68b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionConfigurations.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionConfigurationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TransparentDataEncryptionConfigurations. + */ +public interface TransparentDataEncryptionConfigurations extends HasInner { + /** + * Gets a list of a database's transparent data encryption configurations. There is only ever one element, named 'current', so GetTransparentDataEncryptionConfiguration should be used instead. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitDefinitionType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitDefinitionType.java new file mode 100644 index 0000000000000..3a648c4819063 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitDefinitionType.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnitDefinitionType. + */ +public final class UnitDefinitionType extends ExpandableStringEnum { + /** Static value Count for UnitDefinitionType. */ + public static final UnitDefinitionType COUNT = fromString("Count"); + + /** Static value Bytes for UnitDefinitionType. */ + public static final UnitDefinitionType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitDefinitionType. */ + public static final UnitDefinitionType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitDefinitionType. */ + public static final UnitDefinitionType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitDefinitionType. */ + public static final UnitDefinitionType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitDefinitionType. */ + public static final UnitDefinitionType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** + * Creates or finds a UnitDefinitionType from its string representation. + * @param name a name to look for + * @return the corresponding UnitDefinitionType + */ + @JsonCreator + public static UnitDefinitionType fromString(String name) { + return fromString(name, UnitDefinitionType.class); + } + + /** + * @return known UnitDefinitionType values + */ + public static Collection values() { + return values(UnitDefinitionType.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitType.java new file mode 100644 index 0000000000000..4cd5cf13a0e6c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/UnitType.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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnitType. + */ +public final class UnitType extends ExpandableStringEnum { + /** Static value count for UnitType. */ + public static final UnitType COUNT = fromString("count"); + + /** Static value bytes for UnitType. */ + public static final UnitType BYTES = fromString("bytes"); + + /** Static value seconds for UnitType. */ + public static final UnitType SECONDS = fromString("seconds"); + + /** Static value percent for UnitType. */ + public static final UnitType PERCENT = fromString("percent"); + + /** Static value countPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("countPerSecond"); + + /** Static value bytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("bytesPerSecond"); + + /** + * Creates or finds a UnitType from its string representation. + * @param name a name to look for + * @return the corresponding UnitType + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** + * @return known UnitType values + */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorInner.java new file mode 100644 index 0000000000000..3332bb72aa21d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.AdvisorStatus; +import com.microsoft.azure.management.sql.v2014_04_01.AutoExecuteStatus; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Database Advisor. + */ +@JsonFlatten +public class AdvisorInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Gets the status of availability of this advisor to customers. Possible + * values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and + * 'PrivatePreview'. Possible values include: 'GA', 'PublicPreview', + * 'LimitedPublicPreview', 'PrivatePreview'. + */ + @JsonProperty(value = "properties.advisorStatus", access = JsonProperty.Access.WRITE_ONLY) + private AdvisorStatus advisorStatus; + + /** + * Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and + * 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default'. + */ + @JsonProperty(value = "properties.autoExecuteValue", required = true) + private AutoExecuteStatus autoExecuteValue; + + /** + * Gets that status of recommendations for this advisor and reason for not + * having any recommendations. Possible values include, but are not limited + * to, 'Ok' (Recommendations available), LowActivity (not enough workload + * to analyze), 'DbSeemsTuned' (Database is doing well), etc. + */ + @JsonProperty(value = "properties.recommendationsStatus", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationsStatus; + + /** + * Gets the time when the current resource was analyzed for recommendations + * by this advisor. + */ + @JsonProperty(value = "properties.lastChecked", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastChecked; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. Possible values include: 'GA', 'PublicPreview', 'LimitedPublicPreview', 'PrivatePreview'. + * + * @return the advisorStatus value + */ + public AdvisorStatus advisorStatus() { + return this.advisorStatus; + } + + /** + * Get gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default'. + * + * @return the autoExecuteValue value + */ + public AutoExecuteStatus autoExecuteValue() { + return this.autoExecuteValue; + } + + /** + * Set gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default'. + * + * @param autoExecuteValue the autoExecuteValue value to set + * @return the AdvisorInner object itself. + */ + public AdvisorInner withAutoExecuteValue(AutoExecuteStatus autoExecuteValue) { + this.autoExecuteValue = autoExecuteValue; + return this; + } + + /** + * Get gets that status of recommendations for this advisor and reason for not having any recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations available), LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc. + * + * @return the recommendationsStatus value + */ + public String recommendationsStatus() { + return this.recommendationsStatus; + } + + /** + * Get gets the time when the current resource was analyzed for recommendations by this advisor. + * + * @return the lastChecked value + */ + public DateTime lastChecked() { + return this.lastChecked; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultImpl.java new file mode 100644 index 0000000000000..892b3c5e99662 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultImpl.java @@ -0,0 +1,32 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.AdvisorListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class AdvisorListResultImpl extends WrapperImpl implements AdvisorListResult { + private final SqlManager manager; + AdvisorListResultImpl(AdvisorListResultInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultInner.java new file mode 100644 index 0000000000000..e24043bfccf36 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/AdvisorListResultInner.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.v2014_04_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the response to a list advisors request. + */ +public class AdvisorListResultInner { + /** + * The list of advisors. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the list of advisors. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of advisors. + * + * @param value the value value to set + * @return the AdvisorListResultInner object itself. + */ + public AdvisorListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..ab68ef1a71b20 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionPolicy; + +class BackupLongTermRetentionPoliciesImpl extends WrapperImpl implements BackupLongTermRetentionPolicies { + private final SqlManager manager; + + BackupLongTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().backupLongTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public BackupLongTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private BackupLongTermRetentionPolicyImpl wrapModel(BackupLongTermRetentionPolicyInner inner) { + return new BackupLongTermRetentionPolicyImpl(inner, manager()); + } + + private BackupLongTermRetentionPolicyImpl wrapModel(String name) { + return new BackupLongTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + BackupLongTermRetentionPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public BackupLongTermRetentionPolicy call(BackupLongTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + BackupLongTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupLongTermRetentionPolicy call(BackupLongTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..91006b320ebb2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java @@ -0,0 +1,457 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BackupLongTermRetentionPolicies. + */ +public class BackupLongTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private BackupLongTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupLongTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackupLongTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(BackupLongTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BackupLongTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface BackupLongTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("backupLongTermRetentionPolicyName") String backupLongTermRetentionPolicyName, @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.v2014_04_01.BackupLongTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("backupLongTermRetentionPolicyName") String backupLongTermRetentionPolicyName, @Query("api-version") String apiVersion, @Body BackupLongTermRetentionPolicyInner 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.v2014_04_01.BackupLongTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("backupLongTermRetentionPolicyName") String backupLongTermRetentionPolicyName, @Query("api-version") String apiVersion, @Body BackupLongTermRetentionPolicyInner 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.v2014_04_01.BackupLongTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 backupLongTermRetentionPolicyName = "Default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, backupLongTermRetentionPolicyName, 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 backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention 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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a database backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention 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, BackupLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 backupLongTermRetentionPolicyName = "Default"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, backupLongTermRetentionPolicyName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a database backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention 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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database backup 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 serverName The name of the server. + * @param databaseName The name of the database + * @param parameters The required parameters to update a backup long term retention policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 backupLongTermRetentionPolicyName = "Default"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, backupLongTermRetentionPolicyName, 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); + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @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 List<BackupLongTermRetentionPolicyInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<BackupLongTermRetentionPolicyInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a database backup 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<BackupLongTermRetentionPolicyInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..537477ec6220d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionPolicyState; + +class BackupLongTermRetentionPolicyImpl extends CreatableUpdatableImpl implements BackupLongTermRetentionPolicy, BackupLongTermRetentionPolicy.Definition, BackupLongTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + BackupLongTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new BackupLongTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + BackupLongTermRetentionPolicyImpl(BackupLongTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recoveryServicesBackupPolicyResourceId() { + return this.inner().recoveryServicesBackupPolicyResourceId(); + } + + @Override + public BackupLongTermRetentionPolicyState state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BackupLongTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withRecoveryServicesBackupPolicyResourceId(String recoveryServicesBackupPolicyResourceId) { + this.inner().withRecoveryServicesBackupPolicyResourceId(recoveryServicesBackupPolicyResourceId); + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withState(BackupLongTermRetentionPolicyState state) { + this.inner().withState(state); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..6574b74728fd2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPolicyInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A backup long term retention policy. + */ +@JsonFlatten +public class BackupLongTermRetentionPolicyInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The status of the backup long term retention policy. Possible values + * include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BackupLongTermRetentionPolicyState state; + + /** + * The azure recovery services backup protection policy resource id. + */ + @JsonProperty(value = "properties.recoveryServicesBackupPolicyResourceId", required = true) + private String recoveryServicesBackupPolicyResourceId; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the status of the backup long term retention policy. Possible values include: 'Disabled', 'Enabled'. + * + * @return the state value + */ + public BackupLongTermRetentionPolicyState state() { + return this.state; + } + + /** + * Set the status of the backup long term retention policy. Possible values include: 'Disabled', 'Enabled'. + * + * @param state the state value to set + * @return the BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner withState(BackupLongTermRetentionPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the azure recovery services backup protection policy resource id. + * + * @return the recoveryServicesBackupPolicyResourceId value + */ + public String recoveryServicesBackupPolicyResourceId() { + return this.recoveryServicesBackupPolicyResourceId; + } + + /** + * Set the azure recovery services backup protection policy resource id. + * + * @param recoveryServicesBackupPolicyResourceId the recoveryServicesBackupPolicyResourceId value to set + * @return the BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner withRecoveryServicesBackupPolicyResourceId(String recoveryServicesBackupPolicyResourceId) { + this.recoveryServicesBackupPolicyResourceId = recoveryServicesBackupPolicyResourceId; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultImpl.java new file mode 100644 index 0000000000000..54ad6bec27b78 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultImpl.java @@ -0,0 +1,114 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionVault; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class BackupLongTermRetentionVaultImpl extends CreatableUpdatableImpl implements BackupLongTermRetentionVault, BackupLongTermRetentionVault.Definition, BackupLongTermRetentionVault.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String crecoveryServicesVaultResourceId; + private String urecoveryServicesVaultResourceId; + + BackupLongTermRetentionVaultImpl(String name, SqlManager manager) { + super(name, new BackupLongTermRetentionVaultInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + BackupLongTermRetentionVaultImpl(BackupLongTermRetentionVaultInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + BackupLongTermRetentionVaultsInner client = this.manager().inner().backupLongTermRetentionVaults(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.crecoveryServicesVaultResourceId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackupLongTermRetentionVaultsInner client = this.manager().inner().backupLongTermRetentionVaults(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.urecoveryServicesVaultResourceId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackupLongTermRetentionVaultsInner client = this.manager().inner().backupLongTermRetentionVaults(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recoveryServicesVaultResourceId() { + return this.inner().recoveryServicesVaultResourceId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BackupLongTermRetentionVaultImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public BackupLongTermRetentionVaultImpl withRecoveryServicesVaultResourceId(String recoveryServicesVaultResourceId) { + if (isInCreateMode()) { + this.crecoveryServicesVaultResourceId = recoveryServicesVaultResourceId; + } else { + this.urecoveryServicesVaultResourceId = recoveryServicesVaultResourceId; + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultInner.java new file mode 100644 index 0000000000000..f4d1803e15d5d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultInner.java @@ -0,0 +1,61 @@ +/** + * 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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A backup long term retention vault. + */ +@JsonFlatten +public class BackupLongTermRetentionVaultInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The azure recovery services vault resource id. + */ + @JsonProperty(value = "properties.recoveryServicesVaultResourceId", required = true) + private String recoveryServicesVaultResourceId; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the azure recovery services vault resource id. + * + * @return the recoveryServicesVaultResourceId value + */ + public String recoveryServicesVaultResourceId() { + return this.recoveryServicesVaultResourceId; + } + + /** + * Set the azure recovery services vault resource id. + * + * @param recoveryServicesVaultResourceId the recoveryServicesVaultResourceId value to set + * @return the BackupLongTermRetentionVaultInner object itself. + */ + public BackupLongTermRetentionVaultInner withRecoveryServicesVaultResourceId(String recoveryServicesVaultResourceId) { + this.recoveryServicesVaultResourceId = recoveryServicesVaultResourceId; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsImpl.java new file mode 100644 index 0000000000000..24b7c124bb7f9 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionVaults; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionVault; + +class BackupLongTermRetentionVaultsImpl extends WrapperImpl implements BackupLongTermRetentionVaults { + private final SqlManager manager; + + BackupLongTermRetentionVaultsImpl(SqlManager manager) { + super(manager.inner().backupLongTermRetentionVaults()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public BackupLongTermRetentionVaultImpl define(String name) { + return wrapModel(name); + } + + private BackupLongTermRetentionVaultImpl wrapModel(BackupLongTermRetentionVaultInner inner) { + return new BackupLongTermRetentionVaultImpl(inner, manager()); + } + + private BackupLongTermRetentionVaultImpl wrapModel(String name) { + return new BackupLongTermRetentionVaultImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + BackupLongTermRetentionVaultsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public BackupLongTermRetentionVault call(BackupLongTermRetentionVaultInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + BackupLongTermRetentionVaultsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public BackupLongTermRetentionVault call(BackupLongTermRetentionVaultInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java new file mode 100644 index 0000000000000..5aac3b7669fe2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java @@ -0,0 +1,430 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BackupLongTermRetentionVaults. + */ +public class BackupLongTermRetentionVaultsInner { + /** The Retrofit service to perform REST calls. */ + private BackupLongTermRetentionVaultsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupLongTermRetentionVaultsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackupLongTermRetentionVaultsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(BackupLongTermRetentionVaultsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BackupLongTermRetentionVaults to be + * used by Retrofit to perform actually REST calls. + */ + interface BackupLongTermRetentionVaultsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionVaults get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("backupLongTermRetentionVaultName") String backupLongTermRetentionVaultName, @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.v2014_04_01.BackupLongTermRetentionVaults createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("backupLongTermRetentionVaultName") String backupLongTermRetentionVaultName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupLongTermRetentionVaultInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionVaults beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("backupLongTermRetentionVaultName") String backupLongTermRetentionVaultName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupLongTermRetentionVaultInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionVaults listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults") + 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); + + } + + /** + * Gets a server backup long term retention vault. + * + * @param resourceGroupName The 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 BackupLongTermRetentionVaultInner object if successful. + */ + public BackupLongTermRetentionVaultInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a server backup long term retention vault. + * + * @param resourceGroupName The 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 backup long term retention vault. + * + * @param resourceGroupName The 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 BackupLongTermRetentionVaultInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, BackupLongTermRetentionVaultInner>() { + @Override + public BackupLongTermRetentionVaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server backup long term retention vault. + * + * @param resourceGroupName The 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 BackupLongTermRetentionVaultInner 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 backupLongTermRetentionVaultName = "RegisteredVault"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, backupLongTermRetentionVaultName, 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); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @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 BackupLongTermRetentionVaultInner object if successful. + */ + public BackupLongTermRetentionVaultInner createOrUpdate(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).toBlocking().last().body(); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @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 recoveryServicesVaultResourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId), serviceCallback); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).map(new Func1, BackupLongTermRetentionVaultInner>() { + @Override + public BackupLongTermRetentionVaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { + 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 (recoveryServicesVaultResourceId == null) { + throw new IllegalArgumentException("Parameter recoveryServicesVaultResourceId is required and cannot be null."); + } + final String backupLongTermRetentionVaultName = "RegisteredVault"; + BackupLongTermRetentionVaultInner parameters = new BackupLongTermRetentionVaultInner(); + parameters.withRecoveryServicesVaultResourceId(recoveryServicesVaultResourceId); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, backupLongTermRetentionVaultName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @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 BackupLongTermRetentionVaultInner object if successful. + */ + public BackupLongTermRetentionVaultInner beginCreateOrUpdate(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).toBlocking().single().body(); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @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 recoveryServicesVaultResourceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId), serviceCallback); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionVaultInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).map(new Func1, BackupLongTermRetentionVaultInner>() { + @Override + public BackupLongTermRetentionVaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a server backup long term retention vault. + * + * @param resourceGroupName The 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 recoveryServicesVaultResourceId The azure recovery services vault resource id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionVaultInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { + 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 (recoveryServicesVaultResourceId == null) { + throw new IllegalArgumentException("Parameter recoveryServicesVaultResourceId is required and cannot be null."); + } + final String backupLongTermRetentionVaultName = "RegisteredVault"; + BackupLongTermRetentionVaultInner parameters = new BackupLongTermRetentionVaultInner(); + parameters.withRecoveryServicesVaultResourceId(recoveryServicesVaultResourceId); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, backupLongTermRetentionVaultName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + + /** + * Gets server backup long term retention vaults in 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 List<BackupLongTermRetentionVaultInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets server backup long term retention vaults in 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets server backup long term retention vaults in 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 List<BackupLongTermRetentionVaultInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets server backup long term retention vaults in 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 List<BackupLongTermRetentionVaultInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..cdfdf1df27f78 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Capabilities; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.LocationCapabilities; + +class CapabilitiesImpl extends WrapperImpl implements Capabilities { + private final SqlManager manager; + + CapabilitiesImpl(SqlManager manager) { + super(manager.inner().capabilities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByLocationAsync(String locationId) { + CapabilitiesInner client = this.inner(); + return client.listByLocationAsync(locationId) + .map(new Func1() { + @Override + public LocationCapabilities call(LocationCapabilitiesInner inner) { + return new LocationCapabilitiesImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesInner.java new file mode 100644 index 0000000000000..1ac36c20dac17 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CapabilitiesInner.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.v2014_04_01.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 Capabilities. + */ +public class CapabilitiesInner { + /** The Retrofit service to perform REST calls. */ + private CapabilitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of CapabilitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CapabilitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(CapabilitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Capabilities to be + * used by Retrofit to perform actually REST calls. + */ + interface CapabilitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Capabilities listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities") + Observable> listByLocation(@Path("subscriptionId") String subscriptionId, @Path("locationId") String locationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the capabilities available for the specified location. + * + * @param locationId The location id whose capabilities are 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 LocationCapabilitiesInner object if successful. + */ + public LocationCapabilitiesInner listByLocation(String locationId) { + return listByLocationWithServiceResponseAsync(locationId).toBlocking().single().body(); + } + + /** + * Gets the capabilities available for the specified location. + * + * @param locationId The location id whose capabilities are 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 listByLocationAsync(String locationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(locationId), serviceCallback); + } + + /** + * Gets the capabilities available for the specified location. + * + * @param locationId The location id whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable listByLocationAsync(String locationId) { + return listByLocationWithServiceResponseAsync(locationId).map(new Func1, LocationCapabilitiesInner>() { + @Override + public LocationCapabilitiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the capabilities available for the specified location. + * + * @param locationId The location id whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable> listByLocationWithServiceResponseAsync(String locationId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (locationId == null) { + throw new IllegalArgumentException("Parameter locationId 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(this.client.subscriptionId(), locationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByLocationDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesImpl.java new file mode 100644 index 0000000000000..cd16119815631 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingPolicy; + +class DataMaskingPoliciesImpl extends WrapperImpl implements DataMaskingPolicies { + private final SqlManager manager; + + DataMaskingPoliciesImpl(SqlManager manager) { + super(manager.inner().dataMaskingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DataMaskingPolicyImpl define(String name) { + return wrapModel(name); + } + + private DataMaskingPolicyImpl wrapModel(DataMaskingPolicyInner inner) { + return new DataMaskingPolicyImpl(inner, manager()); + } + + private DataMaskingPolicyImpl wrapModel(String name) { + return new DataMaskingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DataMaskingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DataMaskingPolicy call(DataMaskingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java new file mode 100644 index 0000000000000..a6afd237d9eaa --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java @@ -0,0 +1,263 @@ +/** + * 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.v2014_04_01.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DataMaskingPolicies. + */ +public class DataMaskingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DataMaskingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataMaskingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DataMaskingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataMaskingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DataMaskingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DataMaskingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Query("api-version") String apiVersion, @Body DataMaskingPolicyInner 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.v2014_04_01.DataMaskingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking 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 DataMaskingPolicyInner object if successful. + */ + public DataMaskingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking 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, DataMaskingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DataMaskingPolicyInner>() { + @Override + public DataMaskingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 dataMaskingPolicyName = "Default"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, this.client.apiVersion(), parameters, 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database data masking 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. + * @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 DataMaskingPolicyInner object if successful. + */ + public DataMaskingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database data masking 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. + * @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 data masking 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DataMaskingPolicyInner>() { + @Override + public DataMaskingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database data masking 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 dataMaskingPolicyName = "Default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, 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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyImpl.java new file mode 100644 index 0000000000000..21b027360f68b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyImpl.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. + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingState; + +class DataMaskingPolicyImpl extends CreatableUpdatableImpl implements DataMaskingPolicy, DataMaskingPolicy.Definition, DataMaskingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DataMaskingPolicyImpl(String name, SqlManager manager) { + super(name, new DataMaskingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DataMaskingPolicyImpl(DataMaskingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DataMaskingPoliciesInner client = this.manager().inner().dataMaskingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataMaskingPoliciesInner client = this.manager().inner().dataMaskingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataMaskingPoliciesInner client = this.manager().inner().dataMaskingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String applicationPrincipals() { + return this.inner().applicationPrincipals(); + } + + @Override + public DataMaskingState dataMaskingState() { + return this.inner().dataMaskingState(); + } + + @Override + public String exemptPrincipals() { + return this.inner().exemptPrincipals(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maskingLevel() { + return this.inner().maskingLevel(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataMaskingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DataMaskingPolicyImpl withDataMaskingState(DataMaskingState dataMaskingState) { + this.inner().withDataMaskingState(dataMaskingState); + return this; + } + + @Override + public DataMaskingPolicyImpl withExemptPrincipals(String exemptPrincipals) { + this.inner().withExemptPrincipals(exemptPrincipals); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyInner.java new file mode 100644 index 0000000000000..09cc7c481aff8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPolicyInner.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. + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database data masking policy. + */ +@JsonFlatten +public class DataMaskingPolicyInner extends ProxyResource { + /** + * The state of the data masking policy. Possible values include: + * 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.dataMaskingState", required = true) + private DataMaskingState dataMaskingState; + + /** + * The list of the exempt principals. Specifies the semicolon-separated + * list of database users for which the data masking policy does not apply. + * The specified users receive data results without masking for all of the + * database queries. + */ + @JsonProperty(value = "properties.exemptPrincipals") + private String exemptPrincipals; + + /** + * The list of the application principals. This is a legacy parameter and + * is no longer used. + */ + @JsonProperty(value = "properties.applicationPrincipals", access = JsonProperty.Access.WRITE_ONLY) + private String applicationPrincipals; + + /** + * The masking level. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "properties.maskingLevel", access = JsonProperty.Access.WRITE_ONLY) + private String maskingLevel; + + /** + * The location of the data masking policy. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The kind of data masking policy. Metadata, used for Azure portal. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the state of the data masking policy. Possible values include: 'Disabled', 'Enabled'. + * + * @return the dataMaskingState value + */ + public DataMaskingState dataMaskingState() { + return this.dataMaskingState; + } + + /** + * Set the state of the data masking policy. Possible values include: 'Disabled', 'Enabled'. + * + * @param dataMaskingState the dataMaskingState value to set + * @return the DataMaskingPolicyInner object itself. + */ + public DataMaskingPolicyInner withDataMaskingState(DataMaskingState dataMaskingState) { + this.dataMaskingState = dataMaskingState; + return this; + } + + /** + * Get the list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. + * + * @return the exemptPrincipals value + */ + public String exemptPrincipals() { + return this.exemptPrincipals; + } + + /** + * Set the list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. + * + * @param exemptPrincipals the exemptPrincipals value to set + * @return the DataMaskingPolicyInner object itself. + */ + public DataMaskingPolicyInner withExemptPrincipals(String exemptPrincipals) { + this.exemptPrincipals = exemptPrincipals; + return this; + } + + /** + * Get the list of the application principals. This is a legacy parameter and is no longer used. + * + * @return the applicationPrincipals value + */ + public String applicationPrincipals() { + return this.applicationPrincipals; + } + + /** + * Get the masking level. This is a legacy parameter and is no longer used. + * + * @return the maskingLevel value + */ + public String maskingLevel() { + return this.maskingLevel; + } + + /** + * Get the location of the data masking policy. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the kind of data masking policy. Metadata, used for Azure portal. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleImpl.java new file mode 100644 index 0000000000000..d3f4725bc825f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleImpl.java @@ -0,0 +1,235 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingRuleState; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingFunction; + +class DataMaskingRuleImpl extends CreatableUpdatableImpl implements DataMaskingRule, DataMaskingRule.Definition, DataMaskingRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String dataMaskingRuleName; + + DataMaskingRuleImpl(String name, SqlManager manager) { + super(name, new DataMaskingRuleInner()); + this.manager = manager; + // Set resource name + this.dataMaskingRuleName = name; + // + } + + DataMaskingRuleImpl(DataMaskingRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dataMaskingRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.dataMaskingRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DataMaskingRulesInner client = this.manager().inner().dataMaskingRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.dataMaskingRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataMaskingRulesInner client = this.manager().inner().dataMaskingRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.dataMaskingRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataMaskingRulesInner client = this.manager().inner().dataMaskingRules(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String aliasName() { + return this.inner().aliasName(); + } + + @Override + public String columnName() { + return this.inner().columnName(); + } + + @Override + public String dataMaskingRuleId() { + return this.inner().dataMaskingRuleId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public DataMaskingFunction maskingFunction() { + return this.inner().maskingFunction(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String numberFrom() { + return this.inner().numberFrom(); + } + + @Override + public String numberTo() { + return this.inner().numberTo(); + } + + @Override + public String prefixSize() { + return this.inner().prefixSize(); + } + + @Override + public String replacementString() { + return this.inner().replacementString(); + } + + @Override + public DataMaskingRuleState ruleState() { + return this.inner().ruleState(); + } + + @Override + public String schemaName() { + return this.inner().schemaName(); + } + + @Override + public String suffixSize() { + return this.inner().suffixSize(); + } + + @Override + public String tableName() { + return this.inner().tableName(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataMaskingRuleImpl withExistingDataMaskingPolicy(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DataMaskingRuleImpl withColumnName(String columnName) { + this.inner().withColumnName(columnName); + return this; + } + + @Override + public DataMaskingRuleImpl withMaskingFunction(DataMaskingFunction maskingFunction) { + this.inner().withMaskingFunction(maskingFunction); + return this; + } + + @Override + public DataMaskingRuleImpl withSchemaName(String schemaName) { + this.inner().withSchemaName(schemaName); + return this; + } + + @Override + public DataMaskingRuleImpl withTableName(String tableName) { + this.inner().withTableName(tableName); + return this; + } + + @Override + public DataMaskingRuleImpl withAliasName(String aliasName) { + this.inner().withAliasName(aliasName); + return this; + } + + @Override + public DataMaskingRuleImpl withNumberFrom(String numberFrom) { + this.inner().withNumberFrom(numberFrom); + return this; + } + + @Override + public DataMaskingRuleImpl withNumberTo(String numberTo) { + this.inner().withNumberTo(numberTo); + return this; + } + + @Override + public DataMaskingRuleImpl withPrefixSize(String prefixSize) { + this.inner().withPrefixSize(prefixSize); + return this; + } + + @Override + public DataMaskingRuleImpl withReplacementString(String replacementString) { + this.inner().withReplacementString(replacementString); + return this; + } + + @Override + public DataMaskingRuleImpl withRuleState(DataMaskingRuleState ruleState) { + this.inner().withRuleState(ruleState); + return this; + } + + @Override + public DataMaskingRuleImpl withSuffixSize(String suffixSize) { + this.inner().withSuffixSize(suffixSize); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleInner.java new file mode 100644 index 0000000000000..d01f84f3aac36 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRuleInner.java @@ -0,0 +1,367 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingRuleState; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingFunction; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database data masking rule. + */ +@JsonFlatten +public class DataMaskingRuleInner extends ProxyResource { + /** + * The rule Id. + */ + @JsonProperty(value = "properties.id", access = JsonProperty.Access.WRITE_ONLY) + private String dataMaskingRuleId; + + /** + * The alias name. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "properties.aliasName") + private String aliasName; + + /** + * The rule state. Used to delete a rule. To delete an existing rule, + * specify the schemaName, tableName, columnName, maskingFunction, and + * specify ruleState as disabled. However, if the rule doesn't already + * exist, the rule will be created with ruleState set to enabled, + * regardless of the provided value of ruleState. Possible values include: + * 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.ruleState") + private DataMaskingRuleState ruleState; + + /** + * The schema name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.schemaName", required = true) + private String schemaName; + + /** + * The table name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.tableName", required = true) + private String tableName; + + /** + * The column name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.columnName", required = true) + private String columnName; + + /** + * The masking function that is used for the data masking rule. Possible + * values include: 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text'. + */ + @JsonProperty(value = "properties.maskingFunction", required = true) + private DataMaskingFunction maskingFunction; + + /** + * The numberFrom property of the masking rule. Required if maskingFunction + * is set to Number, otherwise this parameter will be ignored. + */ + @JsonProperty(value = "properties.numberFrom") + private String numberFrom; + + /** + * The numberTo property of the data masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be + * ignored. + */ + @JsonProperty(value = "properties.numberTo") + private String numberTo; + + /** + * If maskingFunction is set to Text, the number of characters to show + * unmasked in the beginning of the string. Otherwise, this parameter will + * be ignored. + */ + @JsonProperty(value = "properties.prefixSize") + private String prefixSize; + + /** + * If maskingFunction is set to Text, the number of characters to show + * unmasked at the end of the string. Otherwise, this parameter will be + * ignored. + */ + @JsonProperty(value = "properties.suffixSize") + private String suffixSize; + + /** + * If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + */ + @JsonProperty(value = "properties.replacementString") + private String replacementString; + + /** + * The location of the data masking rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The kind of Data Masking Rule. Metadata, used for Azure portal. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the rule Id. + * + * @return the dataMaskingRuleId value + */ + public String dataMaskingRuleId() { + return this.dataMaskingRuleId; + } + + /** + * Get the alias name. This is a legacy parameter and is no longer used. + * + * @return the aliasName value + */ + public String aliasName() { + return this.aliasName; + } + + /** + * Set the alias name. This is a legacy parameter and is no longer used. + * + * @param aliasName the aliasName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withAliasName(String aliasName) { + this.aliasName = aliasName; + return this; + } + + /** + * Get the rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'Disabled', 'Enabled'. + * + * @return the ruleState value + */ + public DataMaskingRuleState ruleState() { + return this.ruleState; + } + + /** + * Set the rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'Disabled', 'Enabled'. + * + * @param ruleState the ruleState value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withRuleState(DataMaskingRuleState ruleState) { + this.ruleState = ruleState; + return this; + } + + /** + * Get the schema name on which the data masking rule is applied. + * + * @return the schemaName value + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the schema name on which the data masking rule is applied. + * + * @param schemaName the schemaName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the table name on which the data masking rule is applied. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the table name on which the data masking rule is applied. + * + * @param tableName the tableName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the column name on which the data masking rule is applied. + * + * @return the columnName value + */ + public String columnName() { + return this.columnName; + } + + /** + * Set the column name on which the data masking rule is applied. + * + * @param columnName the columnName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withColumnName(String columnName) { + this.columnName = columnName; + return this; + } + + /** + * Get the masking function that is used for the data masking rule. Possible values include: 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text'. + * + * @return the maskingFunction value + */ + public DataMaskingFunction maskingFunction() { + return this.maskingFunction; + } + + /** + * Set the masking function that is used for the data masking rule. Possible values include: 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text'. + * + * @param maskingFunction the maskingFunction value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withMaskingFunction(DataMaskingFunction maskingFunction) { + this.maskingFunction = maskingFunction; + return this; + } + + /** + * Get the numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @return the numberFrom value + */ + public String numberFrom() { + return this.numberFrom; + } + + /** + * Set the numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @param numberFrom the numberFrom value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withNumberFrom(String numberFrom) { + this.numberFrom = numberFrom; + return this; + } + + /** + * Get the numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @return the numberTo value + */ + public String numberTo() { + return this.numberTo; + } + + /** + * Set the numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @param numberTo the numberTo value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withNumberTo(String numberTo) { + this.numberTo = numberTo; + return this; + } + + /** + * Get if maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. + * + * @return the prefixSize value + */ + public String prefixSize() { + return this.prefixSize; + } + + /** + * Set if maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. + * + * @param prefixSize the prefixSize value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withPrefixSize(String prefixSize) { + this.prefixSize = prefixSize; + return this; + } + + /** + * Get if maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. + * + * @return the suffixSize value + */ + public String suffixSize() { + return this.suffixSize; + } + + /** + * Set if maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. + * + * @param suffixSize the suffixSize value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withSuffixSize(String suffixSize) { + this.suffixSize = suffixSize; + return this; + } + + /** + * Get if maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. + * + * @return the replacementString value + */ + public String replacementString() { + return this.replacementString; + } + + /** + * Set if maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. + * + * @param replacementString the replacementString value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withReplacementString(String replacementString) { + this.replacementString = replacementString; + return this; + } + + /** + * Get the location of the data masking rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the kind of Data Masking Rule. Metadata, used for Azure portal. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesImpl.java new file mode 100644 index 0000000000000..1a762a4e97571 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingRules; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingRule; + +class DataMaskingRulesImpl extends WrapperImpl implements DataMaskingRules { + private final SqlManager manager; + + DataMaskingRulesImpl(SqlManager manager) { + super(manager.inner().dataMaskingRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DataMaskingRuleImpl define(String name) { + return wrapModel(name); + } + + private DataMaskingRuleImpl wrapModel(DataMaskingRuleInner inner) { + return new DataMaskingRuleImpl(inner, manager()); + } + + private DataMaskingRuleImpl wrapModel(String name) { + return new DataMaskingRuleImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + DataMaskingRulesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DataMaskingRule call(DataMaskingRuleInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesInner.java new file mode 100644 index 0000000000000..b36ad38abb6dc --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesInner.java @@ -0,0 +1,277 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DataMaskingRules. + */ +public class DataMaskingRulesInner { + /** The Retrofit service to perform REST calls. */ + private DataMaskingRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataMaskingRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DataMaskingRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataMaskingRules to be + * used by Retrofit to perform actually REST calls. + */ + interface DataMaskingRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DataMaskingRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Path("dataMaskingRuleName") String dataMaskingRuleName, @Query("api-version") String apiVersion, @Body DataMaskingRuleInner 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.v2014_04_01.DataMaskingRules listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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 DataMaskingRuleInner object if successful. + */ + public DataMaskingRuleInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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, String dataMaskingRuleName, DataMaskingRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingRuleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).map(new Func1, DataMaskingRuleInner>() { + @Override + public DataMaskingRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingRuleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataMaskingRuleName == null) { + throw new IllegalArgumentException("Parameter dataMaskingRuleName 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 dataMaskingPolicyName = "Default"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, dataMaskingRuleName, this.client.apiVersion(), parameters, 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 data masking rules. + * + * @param resourceGroupName The 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. + * @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 List<DataMaskingRuleInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataMaskingRuleInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataMaskingRuleInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 dataMaskingPolicyName = "Default"; + return service.listByDatabase(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsImpl.java new file mode 100644 index 0000000000000..7069647c399ca --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseAdvisors; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.AdvisorListResult; +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerAdvisor; + +class DatabaseAdvisorsImpl extends WrapperImpl implements DatabaseAdvisors { + private final SqlManager manager; + + DatabaseAdvisorsImpl(SqlManager manager) { + super(manager.inner().databaseAdvisors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabasisServerAdvisorImpl define(String name) { + return wrapModel(name); + } + + private DatabasisServerAdvisorImpl wrapModel(AdvisorInner inner) { + return new DatabasisServerAdvisorImpl(inner, manager()); + } + + private DatabasisServerAdvisorImpl wrapModel(String name) { + return new DatabasisServerAdvisorImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseAdvisorsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public AdvisorListResult call(AdvisorListResultInner inner) { + return new AdvisorListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + DatabaseAdvisorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, advisorName) + .map(new Func1() { + @Override + public DatabasisServerAdvisor call(AdvisorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java new file mode 100644 index 0000000000000..92840599f4129 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java @@ -0,0 +1,373 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.AutoExecuteStatus; +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.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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseAdvisors. + */ +public class DatabaseAdvisorsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseAdvisorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAdvisorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseAdvisorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseAdvisorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseAdvisors to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseAdvisorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DatabaseAdvisors listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors") + 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.v2014_04_01.DatabaseAdvisors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("advisorName") String advisorName, @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.v2014_04_01.DatabaseAdvisors createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("advisorName") String advisorName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AdvisorInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a list of database advisors. + * + * @param resourceGroupName The 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. + * @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 AdvisorListResultInner object if successful. + */ + public AdvisorListResultInner listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a list of database advisors. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a list of database advisors. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorListResultInner object + */ + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, AdvisorListResultInner>() { + @Override + public AdvisorListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a list of database advisors. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorListResultInner object + */ + public Observable> listByDatabaseWithServiceResponseAsync(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."); + } + 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 clientResponse = listByDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByDatabaseDelegate(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); + } + + /** + * Returns details of a Database Advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @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 AdvisorInner object if successful. + */ + public AdvisorInner get(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).toBlocking().single().body(); + } + + /** + * Returns details of a Database Advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @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, String advisorName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName), serviceCallback); + } + + /** + * Returns details of a Database Advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns details of a Database Advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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, databaseName, advisorName, 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 advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 AdvisorInner object if successful. + */ + public AdvisorInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteValue) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteValue).toBlocking().single().body(); + } + + /** + * Creates or updates a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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, String advisorName, AutoExecuteStatus autoExecuteValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteValue), serviceCallback); + } + + /** + * Creates or updates a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteValue) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteValue).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteValue) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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 (autoExecuteValue == null) { + throw new IllegalArgumentException("Parameter autoExecuteValue is required and cannot be null."); + } + AdvisorInner parameters = new AdvisorInner(); + parameters.withAutoExecuteValue(autoExecuteValue); + return service.createOrUpdate(resourceGroupName, serverName, databaseName, advisorName, 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 = 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()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesImpl.java new file mode 100644 index 0000000000000..e01be37ebdc3f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseConnectionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseConnectionPolicy; + +class DatabaseConnectionPoliciesImpl extends WrapperImpl implements DatabaseConnectionPolicies { + private final SqlManager manager; + + DatabaseConnectionPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseConnectionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseConnectionPolicyImpl define(String name) { + return wrapModel(name); + } + + private DatabaseConnectionPolicyImpl wrapModel(DatabaseConnectionPolicyInner inner) { + return new DatabaseConnectionPolicyImpl(inner, manager()); + } + + private DatabaseConnectionPolicyImpl wrapModel(String name) { + return new DatabaseConnectionPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseConnectionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseConnectionPolicy call(DatabaseConnectionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesInner.java new file mode 100644 index 0000000000000..efd2b39cc5f0e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v2014_04_01.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseConnectionPolicies. + */ +public class DatabaseConnectionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseConnectionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseConnectionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseConnectionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseConnectionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseConnectionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseConnectionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DatabaseConnectionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/connectionPolicies/{connectionPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("connectionPolicyName") String connectionPolicyName, @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.v2014_04_01.DatabaseConnectionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/connectionPolicies/{connectionPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("connectionPolicyName") String connectionPolicyName, @Path("subscriptionId") String subscriptionId, @Body DatabaseConnectionPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection 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 DatabaseConnectionPolicyInner object if successful. + */ + public DatabaseConnectionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection 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 connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseConnectionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseConnectionPolicyInner>() { + @Override + public DatabaseConnectionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseConnectionPolicyInner 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 connectionPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, connectionPolicyName, 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 connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection policy will be defined. + * @param parameters The database connection 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 DatabaseConnectionPolicyInner object if successful. + */ + public DatabaseConnectionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseConnectionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection policy will be defined. + * @param parameters The database connection 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, DatabaseConnectionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection policy will be defined. + * @param parameters The database connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseConnectionPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseConnectionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseConnectionPolicyInner>() { + @Override + public DatabaseConnectionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 connection policy will be defined. + * @param parameters The database connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseConnectionPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseConnectionPolicyInner 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 connectionPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, connectionPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyImpl.java new file mode 100644 index 0000000000000..ad8e6e18e5a7d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyImpl.java @@ -0,0 +1,182 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseConnectionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class DatabaseConnectionPolicyImpl extends CreatableUpdatableImpl implements DatabaseConnectionPolicy, DatabaseConnectionPolicy.Definition, DatabaseConnectionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseConnectionPolicyImpl(String name, SqlManager manager) { + super(name, new DatabaseConnectionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseConnectionPolicyImpl(DatabaseConnectionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DatabaseConnectionPoliciesInner client = this.manager().inner().databaseConnectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseConnectionPoliciesInner client = this.manager().inner().databaseConnectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseConnectionPoliciesInner client = this.manager().inner().databaseConnectionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String proxyDnsName() { + return this.inner().proxyDnsName(); + } + + @Override + public String proxyPort() { + return this.inner().proxyPort(); + } + + @Override + public String redirectionState() { + return this.inner().redirectionState(); + } + + @Override + public String securityEnabledAccess() { + return this.inner().securityEnabledAccess(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String useServerDefault() { + return this.inner().useServerDefault(); + } + + @Override + public String visibility() { + return this.inner().visibility(); + } + + @Override + public DatabaseConnectionPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseConnectionPolicyImpl withProxyDnsName(String proxyDnsName) { + this.inner().withProxyDnsName(proxyDnsName); + return this; + } + + @Override + public DatabaseConnectionPolicyImpl withProxyPort(String proxyPort) { + this.inner().withProxyPort(proxyPort); + return this; + } + + @Override + public DatabaseConnectionPolicyImpl withRedirectionState(String redirectionState) { + this.inner().withRedirectionState(redirectionState); + return this; + } + + @Override + public DatabaseConnectionPolicyImpl withSecurityEnabledAccess(String securityEnabledAccess) { + this.inner().withSecurityEnabledAccess(securityEnabledAccess); + return this; + } + + @Override + public DatabaseConnectionPolicyImpl withState(String state) { + this.inner().withState(state); + return this; + } + + @Override + public DatabaseConnectionPolicyImpl withUseServerDefault(String useServerDefault) { + this.inner().withUseServerDefault(useServerDefault); + return this; + } + + @Override + public DatabaseConnectionPolicyImpl withVisibility(String visibility) { + this.inner().withVisibility(visibility); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyInner.java new file mode 100644 index 0000000000000..eda8a0f7949cb --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPolicyInner.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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database connection policy. + */ +@JsonFlatten +public class DatabaseConnectionPolicyInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The state of security access. + */ + @JsonProperty(value = "properties.securityEnabledAccess") + private String securityEnabledAccess; + + /** + * The fully qualified host name of the auditing proxy. + */ + @JsonProperty(value = "properties.proxyDnsName") + private String proxyDnsName; + + /** + * The port number of the auditing proxy. + */ + @JsonProperty(value = "properties.proxyPort") + private String proxyPort; + + /** + * The visibility of the auditing proxy. + */ + @JsonProperty(value = "properties.visibility") + private String visibility; + + /** + * Whether server default is enabled or disabled. + */ + @JsonProperty(value = "properties.useServerDefault") + private String useServerDefault; + + /** + * The state of proxy redirection. + */ + @JsonProperty(value = "properties.redirectionState") + private String redirectionState; + + /** + * The connection policy state. + */ + @JsonProperty(value = "properties.state") + private String state; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the state of security access. + * + * @return the securityEnabledAccess value + */ + public String securityEnabledAccess() { + return this.securityEnabledAccess; + } + + /** + * Set the state of security access. + * + * @param securityEnabledAccess the securityEnabledAccess value to set + * @return the DatabaseConnectionPolicyInner object itself. + */ + public DatabaseConnectionPolicyInner withSecurityEnabledAccess(String securityEnabledAccess) { + this.securityEnabledAccess = securityEnabledAccess; + return this; + } + + /** + * Get the fully qualified host name of the auditing proxy. + * + * @return the proxyDnsName value + */ + public String proxyDnsName() { + return this.proxyDnsName; + } + + /** + * Set the fully qualified host name of the auditing proxy. + * + * @param proxyDnsName the proxyDnsName value to set + * @return the DatabaseConnectionPolicyInner object itself. + */ + public DatabaseConnectionPolicyInner withProxyDnsName(String proxyDnsName) { + this.proxyDnsName = proxyDnsName; + return this; + } + + /** + * Get the port number of the auditing proxy. + * + * @return the proxyPort value + */ + public String proxyPort() { + return this.proxyPort; + } + + /** + * Set the port number of the auditing proxy. + * + * @param proxyPort the proxyPort value to set + * @return the DatabaseConnectionPolicyInner object itself. + */ + public DatabaseConnectionPolicyInner withProxyPort(String proxyPort) { + this.proxyPort = proxyPort; + return this; + } + + /** + * Get the visibility of the auditing proxy. + * + * @return the visibility value + */ + public String visibility() { + return this.visibility; + } + + /** + * Set the visibility of the auditing proxy. + * + * @param visibility the visibility value to set + * @return the DatabaseConnectionPolicyInner object itself. + */ + public DatabaseConnectionPolicyInner withVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + /** + * Get whether server default is enabled or disabled. + * + * @return the useServerDefault value + */ + public String useServerDefault() { + return this.useServerDefault; + } + + /** + * Set whether server default is enabled or disabled. + * + * @param useServerDefault the useServerDefault value to set + * @return the DatabaseConnectionPolicyInner object itself. + */ + public DatabaseConnectionPolicyInner withUseServerDefault(String useServerDefault) { + this.useServerDefault = useServerDefault; + return this; + } + + /** + * Get the state of proxy redirection. + * + * @return the redirectionState value + */ + public String redirectionState() { + return this.redirectionState; + } + + /** + * Set the state of proxy redirection. + * + * @param redirectionState the redirectionState value to set + * @return the DatabaseConnectionPolicyInner object itself. + */ + public DatabaseConnectionPolicyInner withRedirectionState(String redirectionState) { + this.redirectionState = redirectionState; + return this; + } + + /** + * Get the connection policy state. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Set the connection policy state. + * + * @param state the state value to set + * @return the DatabaseConnectionPolicyInner object itself. + */ + public DatabaseConnectionPolicyInner withState(String state) { + this.state = state; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..64d3c75676d1e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseTableAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseTableAuditingPolicyListResult; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseTableAuditingPolicy; + +class DatabaseTableAuditingPoliciesImpl extends WrapperImpl implements DatabaseTableAuditingPolicies { + private final SqlManager manager; + + DatabaseTableAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseTableAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseTableAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private DatabaseTableAuditingPolicyImpl wrapModel(DatabaseTableAuditingPolicyInner inner) { + return new DatabaseTableAuditingPolicyImpl(inner, manager()); + } + + private DatabaseTableAuditingPolicyImpl wrapModel(String name) { + return new DatabaseTableAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseTableAuditingPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseTableAuditingPolicyListResult call(DatabaseTableAuditingPolicyListResultInner inner) { + return new DatabaseTableAuditingPolicyListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseTableAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseTableAuditingPolicy call(DatabaseTableAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java new file mode 100644 index 0000000000000..e26ea0c79f2c0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java @@ -0,0 +1,361 @@ +/** + * 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.v2014_04_01.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseTableAuditingPolicies. + */ +public class DatabaseTableAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseTableAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseTableAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseTableAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseTableAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseTableAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseTableAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DatabaseTableAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingPolicies/{tableAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("tableAuditingPolicyName") String tableAuditingPolicyName, @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.v2014_04_01.DatabaseTableAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingPolicies/{tableAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("tableAuditingPolicyName") String tableAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body DatabaseTableAuditingPolicyInner 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.v2014_04_01.DatabaseTableAuditingPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingPolicies") + 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); + + } + + /** + * Gets a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit 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 DatabaseTableAuditingPolicyInner object if successful. + */ + public DatabaseTableAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit 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 table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseTableAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseTableAuditingPolicyInner>() { + @Override + public DatabaseTableAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseTableAuditingPolicyInner 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 tableAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, tableAuditingPolicyName, 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 table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table auditing policy will be defined. + * @param parameters The database table auditing 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 DatabaseTableAuditingPolicyInner object if successful. + */ + public DatabaseTableAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseTableAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table auditing policy will be defined. + * @param parameters The database table auditing 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, DatabaseTableAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table auditing policy will be defined. + * @param parameters The database table auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseTableAuditingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseTableAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseTableAuditingPolicyInner>() { + @Override + public DatabaseTableAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table auditing policy will be defined. + * @param parameters The database table auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseTableAuditingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseTableAuditingPolicyInner 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 tableAuditingPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, tableAuditingPolicyName, 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); + } + + /** + * Lists a database's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit 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 DatabaseTableAuditingPolicyListResultInner object if successful. + */ + public DatabaseTableAuditingPolicyListResultInner listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Lists a database's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit 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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Lists a database's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseTableAuditingPolicyListResultInner object + */ + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseTableAuditingPolicyListResultInner>() { + @Override + public DatabaseTableAuditingPolicyListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists a database's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 table audit policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseTableAuditingPolicyListResultInner object + */ + public Observable> listByDatabaseWithServiceResponseAsync(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."); + } + 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 clientResponse = listByDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByDatabaseDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyImpl.java new file mode 100644 index 0000000000000..18d016d6b25b1 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyImpl.java @@ -0,0 +1,238 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseTableAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.UUID; + +class DatabaseTableAuditingPolicyImpl extends CreatableUpdatableImpl implements DatabaseTableAuditingPolicy, DatabaseTableAuditingPolicy.Definition, DatabaseTableAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseTableAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new DatabaseTableAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseTableAuditingPolicyImpl(DatabaseTableAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DatabaseTableAuditingPoliciesInner client = this.manager().inner().databaseTableAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseTableAuditingPoliciesInner client = this.manager().inner().databaseTableAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseTableAuditingPoliciesInner client = this.manager().inner().databaseTableAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String auditingState() { + return this.inner().auditingState(); + } + + @Override + public String auditLogsTableName() { + return this.inner().auditLogsTableName(); + } + + @Override + public String eventTypesToAudit() { + return this.inner().eventTypesToAudit(); + } + + @Override + public String fullAuditLogsTableName() { + return this.inner().fullAuditLogsTableName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String storageAccountKey() { + return this.inner().storageAccountKey(); + } + + @Override + public String storageAccountName() { + return this.inner().storageAccountName(); + } + + @Override + public String storageAccountResourceGroupName() { + return this.inner().storageAccountResourceGroupName(); + } + + @Override + public String storageAccountSecondaryKey() { + return this.inner().storageAccountSecondaryKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageTableEndpoint() { + return this.inner().storageTableEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String useServerDefault() { + return this.inner().useServerDefault(); + } + + @Override + public DatabaseTableAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withAuditingState(String auditingState) { + this.inner().withAuditingState(auditingState); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withAuditLogsTableName(String auditLogsTableName) { + this.inner().withAuditLogsTableName(auditLogsTableName); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withEventTypesToAudit(String eventTypesToAudit) { + this.inner().withEventTypesToAudit(eventTypesToAudit); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withFullAuditLogsTableName(String fullAuditLogsTableName) { + this.inner().withFullAuditLogsTableName(fullAuditLogsTableName); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withRetentionDays(String retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withStorageAccountKey(String storageAccountKey) { + this.inner().withStorageAccountKey(storageAccountKey); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withStorageAccountName(String storageAccountName) { + this.inner().withStorageAccountName(storageAccountName); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withStorageAccountResourceGroupName(String storageAccountResourceGroupName) { + this.inner().withStorageAccountResourceGroupName(storageAccountResourceGroupName); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withStorageAccountSecondaryKey(String storageAccountSecondaryKey) { + this.inner().withStorageAccountSecondaryKey(storageAccountSecondaryKey); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withStorageTableEndpoint(String storageTableEndpoint) { + this.inner().withStorageTableEndpoint(storageTableEndpoint); + return this; + } + + @Override + public DatabaseTableAuditingPolicyImpl withUseServerDefault(String useServerDefault) { + this.inner().withUseServerDefault(useServerDefault); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyInner.java new file mode 100644 index 0000000000000..9206dc0be69b1 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyInner.java @@ -0,0 +1,363 @@ +/** + * 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.v2014_04_01.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database table auditing policy. + */ +@JsonFlatten +public class DatabaseTableAuditingPolicyInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The state of the policy. + */ + @JsonProperty(value = "properties.auditingState") + private String auditingState; + + /** + * The audit logs table name. + */ + @JsonProperty(value = "properties.auditLogsTableName") + private String auditLogsTableName; + + /** + * Comma-separated list of event types to audit. + */ + @JsonProperty(value = "properties.eventTypesToAudit") + private String eventTypesToAudit; + + /** + * The full audit logs table name. + */ + @JsonProperty(value = "properties.fullAuditLogsTableName") + private String fullAuditLogsTableName; + + /** + * The number of days to keep in the audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private String retentionDays; + + /** + * The key of the auditing storage account. + */ + @JsonProperty(value = "properties.storageAccountKey") + private String storageAccountKey; + + /** + * The table storage account name. + */ + @JsonProperty(value = "properties.storageAccountName") + private String storageAccountName; + + /** + * The table storage account resource group name. + */ + @JsonProperty(value = "properties.storageAccountResourceGroupName") + private String storageAccountResourceGroupName; + + /** + * The secondary key of the auditing storage account. + */ + @JsonProperty(value = "properties.storageAccountSecondaryKey") + private String storageAccountSecondaryKey; + + /** + * The table storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * The storage table endpoint. + */ + @JsonProperty(value = "properties.storageTableEndpoint") + private String storageTableEndpoint; + + /** + * Whether server default is enabled or disabled. + */ + @JsonProperty(value = "properties.useServerDefault") + private String useServerDefault; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the state of the policy. + * + * @return the auditingState value + */ + public String auditingState() { + return this.auditingState; + } + + /** + * Set the state of the policy. + * + * @param auditingState the auditingState value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withAuditingState(String auditingState) { + this.auditingState = auditingState; + return this; + } + + /** + * Get the audit logs table name. + * + * @return the auditLogsTableName value + */ + public String auditLogsTableName() { + return this.auditLogsTableName; + } + + /** + * Set the audit logs table name. + * + * @param auditLogsTableName the auditLogsTableName value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withAuditLogsTableName(String auditLogsTableName) { + this.auditLogsTableName = auditLogsTableName; + return this; + } + + /** + * Get comma-separated list of event types to audit. + * + * @return the eventTypesToAudit value + */ + public String eventTypesToAudit() { + return this.eventTypesToAudit; + } + + /** + * Set comma-separated list of event types to audit. + * + * @param eventTypesToAudit the eventTypesToAudit value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withEventTypesToAudit(String eventTypesToAudit) { + this.eventTypesToAudit = eventTypesToAudit; + return this; + } + + /** + * Get the full audit logs table name. + * + * @return the fullAuditLogsTableName value + */ + public String fullAuditLogsTableName() { + return this.fullAuditLogsTableName; + } + + /** + * Set the full audit logs table name. + * + * @param fullAuditLogsTableName the fullAuditLogsTableName value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withFullAuditLogsTableName(String fullAuditLogsTableName) { + this.fullAuditLogsTableName = fullAuditLogsTableName; + return this; + } + + /** + * Get the number of days to keep in the audit logs. + * + * @return the retentionDays value + */ + public String retentionDays() { + return this.retentionDays; + } + + /** + * Set the number of days to keep in the audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withRetentionDays(String retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the key of the auditing storage account. + * + * @return the storageAccountKey value + */ + public String storageAccountKey() { + return this.storageAccountKey; + } + + /** + * Set the key of the auditing storage account. + * + * @param storageAccountKey the storageAccountKey value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withStorageAccountKey(String storageAccountKey) { + this.storageAccountKey = storageAccountKey; + return this; + } + + /** + * Get the table storage account name. + * + * @return the storageAccountName value + */ + public String storageAccountName() { + return this.storageAccountName; + } + + /** + * Set the table storage account name. + * + * @param storageAccountName the storageAccountName value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withStorageAccountName(String storageAccountName) { + this.storageAccountName = storageAccountName; + return this; + } + + /** + * Get the table storage account resource group name. + * + * @return the storageAccountResourceGroupName value + */ + public String storageAccountResourceGroupName() { + return this.storageAccountResourceGroupName; + } + + /** + * Set the table storage account resource group name. + * + * @param storageAccountResourceGroupName the storageAccountResourceGroupName value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withStorageAccountResourceGroupName(String storageAccountResourceGroupName) { + this.storageAccountResourceGroupName = storageAccountResourceGroupName; + return this; + } + + /** + * Get the secondary key of the auditing storage account. + * + * @return the storageAccountSecondaryKey value + */ + public String storageAccountSecondaryKey() { + return this.storageAccountSecondaryKey; + } + + /** + * Set the secondary key of the auditing storage account. + * + * @param storageAccountSecondaryKey the storageAccountSecondaryKey value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withStorageAccountSecondaryKey(String storageAccountSecondaryKey) { + this.storageAccountSecondaryKey = storageAccountSecondaryKey; + return this; + } + + /** + * Get the table storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the table storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get the storage table endpoint. + * + * @return the storageTableEndpoint value + */ + public String storageTableEndpoint() { + return this.storageTableEndpoint; + } + + /** + * Set the storage table endpoint. + * + * @param storageTableEndpoint the storageTableEndpoint value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withStorageTableEndpoint(String storageTableEndpoint) { + this.storageTableEndpoint = storageTableEndpoint; + return this; + } + + /** + * Get whether server default is enabled or disabled. + * + * @return the useServerDefault value + */ + public String useServerDefault() { + return this.useServerDefault; + } + + /** + * Set whether server default is enabled or disabled. + * + * @param useServerDefault the useServerDefault value to set + * @return the DatabaseTableAuditingPolicyInner object itself. + */ + public DatabaseTableAuditingPolicyInner withUseServerDefault(String useServerDefault) { + this.useServerDefault = useServerDefault; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultImpl.java new file mode 100644 index 0000000000000..50aa1d9d5fbba --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultImpl.java @@ -0,0 +1,32 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseTableAuditingPolicyListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class DatabaseTableAuditingPolicyListResultImpl extends WrapperImpl implements DatabaseTableAuditingPolicyListResult { + private final SqlManager manager; + DatabaseTableAuditingPolicyListResultImpl(DatabaseTableAuditingPolicyListResultInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultInner.java new file mode 100644 index 0000000000000..db9585f1ee3f3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPolicyListResultInner.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.v2014_04_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the response to a list database table auditing policies request. + */ +public class DatabaseTableAuditingPolicyListResultInner { + /** + * The list of database table auditing policies. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the list of database table auditing policies. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of database table auditing policies. + * + * @param value the value value to set + * @return the DatabaseTableAuditingPolicyListResultInner object itself. + */ + public DatabaseTableAuditingPolicyListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageImpl.java new file mode 100644 index 0000000000000..2852c083d78ee --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class DatabaseUsageImpl extends WrapperImpl implements DatabaseUsage { + private final SqlManager manager; + + DatabaseUsageImpl(DatabaseUsageInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime nextResetTime() { + return this.inner().nextResetTime(); + } + + @Override + public String resourceName() { + return this.inner().resourceName(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageInner.java new file mode 100644 index 0000000000000..ae1c79201e474 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsageInner.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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The database usages. + */ +public class DatabaseUsageInner { + /** + * The name of the usage metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The name of the resource. + */ + @JsonProperty(value = "resourceName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceName; + + /** + * The usage metric display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The current value of the usage metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /** + * The current limit of the usage metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * The units of the usage metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The next reset time for the usage metric (ISO8601 format). + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime nextResetTime; + + /** + * Get the name of the usage metric. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the name of the resource. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the usage metric display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the current value of the usage metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the current limit of the usage metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get the units of the usage metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the next reset time for the usage metric (ISO8601 format). + * + * @return the nextResetTime value + */ + public DateTime nextResetTime() { + return this.nextResetTime; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesImpl.java new file mode 100644 index 0000000000000..c317f76d34a68 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUsages; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUsage; + +class DatabaseUsagesImpl extends WrapperImpl implements DatabaseUsages { + private final SqlManager manager; + + DatabaseUsagesImpl(SqlManager manager) { + super(manager.inner().databaseUsages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabaseUsageImpl wrapModel(DatabaseUsageInner inner) { + return new DatabaseUsageImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseUsagesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabaseUsage call(DatabaseUsageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesInner.java new file mode 100644 index 0000000000000..e88bd12a564d5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseUsagesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseUsages. + */ +public class DatabaseUsagesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseUsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseUsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseUsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseUsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseUsages to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseUsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DatabaseUsages listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @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 List<DatabaseUsageInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseUsageInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseUsageInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java index a1e17953b8ea5..db2277bd52fca 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java @@ -19,6 +19,8 @@ import com.microsoft.azure.management.sql.v2014_04_01.ImportExportResponse; import com.microsoft.azure.management.sql.v2014_04_01.ExportRequest; import com.microsoft.azure.management.sql.v2014_04_01.ImportRequest; +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerMetric; +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerMetricDefinition; class DatabasesImpl extends WrapperImpl implements Databases { private final SqlManager manager; @@ -178,6 +180,14 @@ private ImportExportResponseImpl wrapImportExportResponseModel(ImportExportRespo return new ImportExportResponseImpl(inner, manager()); } + private DatabasisServerMetricImpl wrapDatabasisServerMetricModel(MetricInner inner) { + return new DatabasisServerMetricImpl(inner, manager()); + } + + private DatabasisServerMetricDefinitionImpl wrapDatabasisServerMetricDefinitionModel(MetricDefinitionInner inner) { + return new DatabasisServerMetricDefinitionImpl(inner, manager()); + } + @Override public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { DatabasesInner client = this.inner(); @@ -190,4 +200,40 @@ public ImportExportResponse call(ImportExportResponseInner inner) { }); } + @Override + public Observable listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter) { + DatabasesInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, serverName, databaseName, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisServerMetric call(MetricInner inner) { + return wrapDatabasisServerMetricModel(inner); + } + }); + } + + @Override + public Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.listMetricDefinitionsAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisServerMetricDefinition call(MetricDefinitionInner inner) { + return wrapDatabasisServerMetricDefinitionModel(inner); + } + }); + } + } diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java index d1ccf2cecc619..c19c32fdf93c1 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java @@ -146,6 +146,14 @@ interface DatabasesService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") Observable> beginExport(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest 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.v2014_04_01.Databases listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.v2014_04_01.Databases listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -2261,4 +2269,207 @@ private ServiceResponse beginExportDelegate(Response< .build(response); } + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String serverName, String databaseName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter).toBlocking().single().body(); + } + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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> listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter), serviceCallback); + } + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String filter) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(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); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @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 List<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String serverName, String databaseName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricDefinitionsDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerAdvisorImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerAdvisorImpl.java new file mode 100644 index 0000000000000..bd107ca2b184c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerAdvisorImpl.java @@ -0,0 +1,142 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerAdvisor; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.AutoExecuteStatus; +import com.microsoft.azure.management.sql.v2014_04_01.AdvisorStatus; +import org.joda.time.DateTime; + +class DatabasisServerAdvisorImpl extends CreatableUpdatableImpl implements DatabasisServerAdvisor, DatabasisServerAdvisor.Definition, DatabasisServerAdvisor.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String advisorName; + private AutoExecuteStatus cautoExecuteValue; + private AutoExecuteStatus uautoExecuteValue; + + DatabasisServerAdvisorImpl(String name, SqlManager manager) { + super(name, new AdvisorInner()); + this.manager = manager; + // Set resource name + this.advisorName = name; + // + } + + DatabasisServerAdvisorImpl(AdvisorInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.advisorName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.advisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "advisors"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabaseAdvisorsInner client = this.manager().inner().databaseAdvisors(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.advisorName, this.cautoExecuteValue) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseAdvisorsInner client = this.manager().inner().databaseAdvisors(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.advisorName, this.uautoExecuteValue) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseAdvisorsInner client = this.manager().inner().databaseAdvisors(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.advisorName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AdvisorStatus advisorStatus() { + return this.inner().advisorStatus(); + } + + @Override + public AutoExecuteStatus autoExecuteValue() { + return this.inner().autoExecuteValue(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DateTime lastChecked() { + return this.inner().lastChecked(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recommendationsStatus() { + return this.inner().recommendationsStatus(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabasisServerAdvisorImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabasisServerAdvisorImpl withAutoExecuteValue(AutoExecuteStatus autoExecuteValue) { + if (isInCreateMode()) { + this.cautoExecuteValue = autoExecuteValue; + } else { + this.uautoExecuteValue = autoExecuteValue; + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricDefinitionImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricDefinitionImpl.java new file mode 100644 index 0000000000000..eb2bd022a4666 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricDefinitionImpl.java @@ -0,0 +1,60 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.MetricAvailability; +import com.microsoft.azure.management.sql.v2014_04_01.MetricName; +import com.microsoft.azure.management.sql.v2014_04_01.PrimaryAggregationType; +import com.microsoft.azure.management.sql.v2014_04_01.UnitDefinitionType; + +class DatabasisServerMetricDefinitionImpl extends WrapperImpl implements DatabasisServerMetricDefinition { + private final SqlManager manager; + + DatabasisServerMetricDefinitionImpl(MetricDefinitionInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public PrimaryAggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceUri() { + return this.inner().resourceUri(); + } + + @Override + public UnitDefinitionType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricImpl.java new file mode 100644 index 0000000000000..456ddad6435fd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasisServerMetricImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabasisServerMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.MetricValue; +import com.microsoft.azure.management.sql.v2014_04_01.MetricName; +import com.microsoft.azure.management.sql.v2014_04_01.UnitType; + +class DatabasisServerMetricImpl extends WrapperImpl implements DatabasisServerMetric { + private final SqlManager manager; + + DatabasisServerMetricImpl(MetricInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationImpl.java new file mode 100644 index 0000000000000..f88eef07a5f23 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfiguration; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationAutoFailover; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationFailoverPolicy; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationRole; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationStatus; + +class DisasterRecoveryConfigurationImpl extends WrapperImpl implements DisasterRecoveryConfiguration { + private final SqlManager manager; + DisasterRecoveryConfigurationImpl(DisasterRecoveryConfigurationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public DisasterRecoveryConfigurationAutoFailover autoFailover() { + return this.inner().autoFailover(); + } + + @Override + public DisasterRecoveryConfigurationFailoverPolicy failoverPolicy() { + return this.inner().failoverPolicy(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String logicalServerName() { + return this.inner().logicalServerName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerLogicalServerName() { + return this.inner().partnerLogicalServerName(); + } + + @Override + public String partnerServerId() { + return this.inner().partnerServerId(); + } + + @Override + public DisasterRecoveryConfigurationRole role() { + return this.inner().role(); + } + + @Override + public DisasterRecoveryConfigurationStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationInner.java new file mode 100644 index 0000000000000..2e2ae8ab29db3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationInner.java @@ -0,0 +1,182 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationStatus; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationAutoFailover; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationFailoverPolicy; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurationRole; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a disaster recovery configuration. + */ +@JsonFlatten +public class DisasterRecoveryConfigurationInner extends ProxyResource { + /** + * The status of the disaster recovery configuration. Possible values + * include: 'Creating', 'Ready', 'FailingOver', 'Dropping'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DisasterRecoveryConfigurationStatus status; + + /** + * Whether or not failover can be done automatically. Possible values + * include: 'Off', 'On'. + */ + @JsonProperty(value = "properties.autoFailover", required = true) + private DisasterRecoveryConfigurationAutoFailover autoFailover; + + /** + * How aggressive the automatic failover should be. Possible values + * include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "properties.failoverPolicy", required = true) + private DisasterRecoveryConfigurationFailoverPolicy failoverPolicy; + + /** + * Id of the partner server. + */ + @JsonProperty(value = "properties.partnerServerId", required = true) + private String partnerServerId; + + /** + * Logical name of the server. + */ + @JsonProperty(value = "properties.logicalServerName", access = JsonProperty.Access.WRITE_ONLY) + private String logicalServerName; + + /** + * Logical name of the partner server. + */ + @JsonProperty(value = "properties.partnerLogicalServerName", access = JsonProperty.Access.WRITE_ONLY) + private String partnerLogicalServerName; + + /** + * The role of the current server in the disaster recovery configuration. + * Possible values include: 'None', 'Primary', 'Secondary'. + */ + @JsonProperty(value = "properties.role", access = JsonProperty.Access.WRITE_ONLY) + private DisasterRecoveryConfigurationRole role; + + /** + * Location of the server that contains this disaster recovery + * configuration. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the status of the disaster recovery configuration. Possible values include: 'Creating', 'Ready', 'FailingOver', 'Dropping'. + * + * @return the status value + */ + public DisasterRecoveryConfigurationStatus status() { + return this.status; + } + + /** + * Get whether or not failover can be done automatically. Possible values include: 'Off', 'On'. + * + * @return the autoFailover value + */ + public DisasterRecoveryConfigurationAutoFailover autoFailover() { + return this.autoFailover; + } + + /** + * Set whether or not failover can be done automatically. Possible values include: 'Off', 'On'. + * + * @param autoFailover the autoFailover value to set + * @return the DisasterRecoveryConfigurationInner object itself. + */ + public DisasterRecoveryConfigurationInner withAutoFailover(DisasterRecoveryConfigurationAutoFailover autoFailover) { + this.autoFailover = autoFailover; + return this; + } + + /** + * Get how aggressive the automatic failover should be. Possible values include: 'Manual', 'Automatic'. + * + * @return the failoverPolicy value + */ + public DisasterRecoveryConfigurationFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set how aggressive the automatic failover should be. Possible values include: 'Manual', 'Automatic'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the DisasterRecoveryConfigurationInner object itself. + */ + public DisasterRecoveryConfigurationInner withFailoverPolicy(DisasterRecoveryConfigurationFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get id of the partner server. + * + * @return the partnerServerId value + */ + public String partnerServerId() { + return this.partnerServerId; + } + + /** + * Set id of the partner server. + * + * @param partnerServerId the partnerServerId value to set + * @return the DisasterRecoveryConfigurationInner object itself. + */ + public DisasterRecoveryConfigurationInner withPartnerServerId(String partnerServerId) { + this.partnerServerId = partnerServerId; + return this; + } + + /** + * Get logical name of the server. + * + * @return the logicalServerName value + */ + public String logicalServerName() { + return this.logicalServerName; + } + + /** + * Get logical name of the partner server. + * + * @return the partnerLogicalServerName value + */ + public String partnerLogicalServerName() { + return this.partnerLogicalServerName; + } + + /** + * Get the role of the current server in the disaster recovery configuration. Possible values include: 'None', 'Primary', 'Secondary'. + * + * @return the role value + */ + public DisasterRecoveryConfigurationRole role() { + return this.role; + } + + /** + * Get location of the server that contains this disaster recovery configuration. + * + * @return the location value + */ + public String location() { + return this.location; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsImpl.java new file mode 100644 index 0000000000000..76209c0e25269 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurations; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfiguration; + +class DisasterRecoveryConfigurationsImpl extends WrapperImpl implements DisasterRecoveryConfigurations { + private final SqlManager manager; + + DisasterRecoveryConfigurationsImpl(SqlManager manager) { + super(manager.inner().disasterRecoveryConfigurations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String resourceGroupName, String serverName) { + DisasterRecoveryConfigurationsInner client = this.inner(); + return client.listAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DisasterRecoveryConfiguration call(DisasterRecoveryConfigurationInner inner) { + return new DisasterRecoveryConfigurationImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + DisasterRecoveryConfigurationsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + DisasterRecoveryConfigurationsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName) + .map(new Func1() { + @Override + public DisasterRecoveryConfiguration call(DisasterRecoveryConfigurationInner inner) { + return new DisasterRecoveryConfigurationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + DisasterRecoveryConfigurationsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName) + .map(new Func1() { + @Override + public DisasterRecoveryConfiguration call(DisasterRecoveryConfigurationInner inner) { + return new DisasterRecoveryConfigurationImpl(inner, manager()); + } + }); + } + + @Override + public Completable failoverAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + DisasterRecoveryConfigurationsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toCompletable(); + } + + @Override + public Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + DisasterRecoveryConfigurationsInner client = this.inner(); + return client.failoverAllowDataLossAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java new file mode 100644 index 0000000000000..fbad8a25049b0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java @@ -0,0 +1,960 @@ +/** + * 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.v2014_04_01.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 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.POST; +import retrofit2.http.PUT; +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 DisasterRecoveryConfigurations. + */ +public class DisasterRecoveryConfigurationsInner { + /** The Retrofit service to perform REST calls. */ + private DisasterRecoveryConfigurationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DisasterRecoveryConfigurationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DisasterRecoveryConfigurationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DisasterRecoveryConfigurationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DisasterRecoveryConfigurations to be + * used by Retrofit to perform actually REST calls. + */ + interface DisasterRecoveryConfigurationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurations list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration") + Observable> list(@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.v2014_04_01.DisasterRecoveryConfigurations delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/failover") + Observable> failover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/failover") + Observable> beginFailover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations failoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/forceFailoverAllowDataLoss") + Observable> failoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @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.v2014_04_01.DisasterRecoveryConfigurations beginFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/forceFailoverAllowDataLoss") + Observable> beginFailoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("disasterRecoveryConfigurationName") String disasterRecoveryConfigurationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a server's disaster recovery configuration. + * + * @param resourceGroupName The 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 List<DisasterRecoveryConfigurationInner> object if successful. + */ + public List list(String resourceGroupName, String serverName) { + return listWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Lists a server's disaster recovery configuration. + * + * @param resourceGroupName The 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> listAsync(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Lists a server's disaster recovery configuration. + * + * @param resourceGroupName The 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 List<DisasterRecoveryConfigurationInner> object + */ + public Observable> listAsync(String resourceGroupName, String serverName) { + return listWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a server's disaster recovery configuration. + * + * @param resourceGroupName The 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 List<DisasterRecoveryConfigurationInner> object + */ + public Observable>> listWithServiceResponseAsync(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."); + } + return service.list(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 = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 serverName, String disasterRecoveryConfigurationName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 serverName, String disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 serverName, String disasterRecoveryConfigurationName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body(); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 serverName, String disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, 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); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/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 DisasterRecoveryConfigurationInner object if successful. + */ + public DisasterRecoveryConfigurationInner createOrUpdate(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/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 createOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, DisasterRecoveryConfigurationInner>() { + @Override + public DisasterRecoveryConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/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 DisasterRecoveryConfigurationInner object if successful. + */ + public DisasterRecoveryConfigurationInner beginCreateOrUpdate(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body(); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DisasterRecoveryConfigurationInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, DisasterRecoveryConfigurationInner>() { + @Override + public DisasterRecoveryConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DisasterRecoveryConfigurationInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, 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); + } + + /** + * Gets a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration. + * @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 DisasterRecoveryConfigurationInner object if successful. + */ + public DisasterRecoveryConfigurationInner get(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body(); + } + + /** + * Gets a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration. + * @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 disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Gets a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DisasterRecoveryConfigurationInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, DisasterRecoveryConfigurationInner>() { + @Override + public DisasterRecoveryConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a disaster recovery configuration. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DisasterRecoveryConfigurationInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, 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); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 disasterRecoveryConfigurationName) { + failoverWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 disasterRecoveryConfigurationName) { + beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 disasterRecoveryConfigurationName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration 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 disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, 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(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @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 failoverAllowDataLoss(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @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 failoverAllowDataLossAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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.failoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @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 beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @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 beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName), serviceCallback); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 disasterRecoveryConfigurationName The name of the disaster recovery configuration to failover forcefully. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { + 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 (disasterRecoveryConfigurationName == null) { + throw new IllegalArgumentException("Parameter disasterRecoveryConfigurationName 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.beginFailoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, disasterRecoveryConfigurationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverAllowDataLossDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricDefinitionImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricDefinitionImpl.java new file mode 100644 index 0000000000000..005e3abb6f93f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricDefinitionImpl.java @@ -0,0 +1,60 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolServerMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.MetricAvailability; +import com.microsoft.azure.management.sql.v2014_04_01.MetricName; +import com.microsoft.azure.management.sql.v2014_04_01.PrimaryAggregationType; +import com.microsoft.azure.management.sql.v2014_04_01.UnitDefinitionType; + +class ElasticPoolServerMetricDefinitionImpl extends WrapperImpl implements ElasticPoolServerMetricDefinition { + private final SqlManager manager; + + ElasticPoolServerMetricDefinitionImpl(MetricDefinitionInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public PrimaryAggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceUri() { + return this.inner().resourceUri(); + } + + @Override + public UnitDefinitionType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricImpl.java new file mode 100644 index 0000000000000..8d0fcd2a0f12d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolServerMetricImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolServerMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.MetricValue; +import com.microsoft.azure.management.sql.v2014_04_01.MetricName; +import com.microsoft.azure.management.sql.v2014_04_01.UnitType; + +class ElasticPoolServerMetricImpl extends WrapperImpl implements ElasticPoolServerMetric { + private final SqlManager manager; + + ElasticPoolServerMetricImpl(MetricInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java index aea59fae7ed1c..ed7df4953b726 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java @@ -16,6 +16,8 @@ import rx.functions.Func1; import java.util.List; import com.microsoft.azure.management.sql.v2014_04_01.ElasticPool; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolServerMetric; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolServerMetricDefinition; class ElasticPoolsImpl extends WrapperImpl implements ElasticPools { private final SqlManager manager; @@ -78,4 +80,48 @@ public Completable deleteAsync(String resourceGroupName, String serverName, Stri return client.deleteAsync(resourceGroupName, serverName, elasticPoolName).toCompletable(); } + private ElasticPoolServerMetricImpl wrapElasticPoolServerMetricModel(MetricInner inner) { + return new ElasticPoolServerMetricImpl(inner, manager()); + } + + private ElasticPoolServerMetricDefinitionImpl wrapElasticPoolServerMetricDefinitionModel(MetricDefinitionInner inner) { + return new ElasticPoolServerMetricDefinitionImpl(inner, manager()); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + ElasticPoolsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, serverName, elasticPoolName, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolServerMetric call(MetricInner inner) { + return wrapElasticPoolServerMetricModel(inner); + } + }); + } + + @Override + public Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.listMetricDefinitionsAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolServerMetricDefinition call(MetricDefinitionInner inner) { + return wrapElasticPoolServerMetricDefinitionModel(inner); + } + }); + } + } diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java index e4d2a1955e77c..bb742b28437a5 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java @@ -86,6 +86,14 @@ interface ElasticPoolsService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools") 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.v2014_04_01.ElasticPools listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.v2014_04_01.ElasticPools listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -738,4 +746,207 @@ private ServiceResponse> listByServerDelegate(Respons .build(response); } + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, filter).toBlocking().single().body(); + } + + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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> listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, filter), serviceCallback); + } + + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(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); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @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 List<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String serverName, String elasticPoolName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricDefinitionsDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsImpl.java new file mode 100644 index 0000000000000..349d07802c900 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsImpl.java @@ -0,0 +1,37 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Extensions; +import rx.Completable; +import rx.Observable; +import java.util.List; +import rx.functions.Func1; + +class ExtensionsImpl extends WrapperImpl implements Extensions { + private final SqlManager manager; + + ExtensionsImpl(SqlManager manager) { + super(manager.inner().extensions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + ExtensionsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsInner.java new file mode 100644 index 0000000000000..e392579420825 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ExtensionsInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Extensions. + */ +public class ExtensionsInner { + /** The Retrofit service to perform REST calls. */ + private ExtensionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtensionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ExtensionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ExtensionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Extensions to be + * used by Retrofit to perform actually REST calls. + */ + interface ExtensionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Extensions listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets database extensions. + * + * @param resourceGroupName The 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 import into + * @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 List<Object> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets database extensions. + * + * @param resourceGroupName The 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 import into + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets database extensions. + * + * @param resourceGroupName The 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 import into + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Object> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets database extensions. + * + * @param resourceGroupName The 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 import into + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Object> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesImpl.java new file mode 100644 index 0000000000000..0d2db402bdfc8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicies; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicy; + +class GeoBackupPoliciesImpl extends WrapperImpl implements GeoBackupPolicies { + private final SqlManager manager; + + GeoBackupPoliciesImpl(SqlManager manager) { + super(manager.inner().geoBackupPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public GeoBackupPolicyImpl define(String name) { + return wrapModel(name); + } + + private GeoBackupPolicyImpl wrapModel(GeoBackupPolicyInner inner) { + return new GeoBackupPolicyImpl(inner, manager()); + } + + private GeoBackupPolicyImpl wrapModel(String name) { + return new GeoBackupPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + GeoBackupPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public GeoBackupPolicy call(GeoBackupPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + GeoBackupPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public GeoBackupPolicy call(GeoBackupPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesInner.java new file mode 100644 index 0000000000000..f6643258b45a1 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesInner.java @@ -0,0 +1,368 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicyState; +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.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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in GeoBackupPolicies. + */ +public class GeoBackupPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private GeoBackupPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of GeoBackupPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GeoBackupPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(GeoBackupPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for GeoBackupPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface GeoBackupPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("geoBackupPolicyName") String geoBackupPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body GeoBackupPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("geoBackupPolicyName") String geoBackupPolicyName, @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.v2014_04_01.GeoBackupPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @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 GeoBackupPolicyInner object if successful. + */ + public GeoBackupPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state).toBlocking().single().body(); + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @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, GeoBackupPolicyState state, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state), serviceCallback); + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state).map(new Func1, GeoBackupPolicyInner>() { + @Override + public GeoBackupPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 (state == null) { + throw new IllegalArgumentException("Parameter state is required and cannot be null."); + } + final String geoBackupPolicyName = "Default"; + GeoBackupPolicyInner parameters = new GeoBackupPolicyInner(); + parameters.withState(state); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 geo backup 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. + * @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 GeoBackupPolicyInner object if successful. + */ + public GeoBackupPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a geo backup 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. + * @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 geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, GeoBackupPolicyInner>() { + @Override + public GeoBackupPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 geoBackupPolicyName = "Default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, geoBackupPolicyName, 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); + } + + /** + * Returns a list of geo backup 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. + * @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 List<GeoBackupPolicyInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a list of geo backup 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a list of geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<GeoBackupPolicyInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<GeoBackupPolicyInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyImpl.java new file mode 100644 index 0000000000000..991a30c850260 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicyState; + +class GeoBackupPolicyImpl extends CreatableUpdatableImpl implements GeoBackupPolicy, GeoBackupPolicy.Definition, GeoBackupPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private GeoBackupPolicyState cstate; + private GeoBackupPolicyState ustate; + + GeoBackupPolicyImpl(String name, SqlManager manager) { + super(name, new GeoBackupPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + GeoBackupPolicyImpl(GeoBackupPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + GeoBackupPoliciesInner client = this.manager().inner().geoBackupPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.cstate) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + GeoBackupPoliciesInner client = this.manager().inner().geoBackupPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ustate) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + GeoBackupPoliciesInner client = this.manager().inner().geoBackupPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public GeoBackupPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageType() { + return this.inner().storageType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public GeoBackupPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public GeoBackupPolicyImpl withState(GeoBackupPolicyState state) { + if (isInCreateMode()) { + this.cstate = state; + } else { + this.ustate = state; + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyInner.java new file mode 100644 index 0000000000000..aa9b78e348e66 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPolicyInner.java @@ -0,0 +1,94 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database geo backup policy. + */ +@JsonFlatten +public class GeoBackupPolicyInner extends ProxyResource { + /** + * The state of the geo backup policy. Possible values include: 'Disabled', + * 'Enabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private GeoBackupPolicyState state; + + /** + * The storage type of the geo backup policy. + */ + @JsonProperty(value = "properties.storageType", access = JsonProperty.Access.WRITE_ONLY) + private String storageType; + + /** + * Kind of geo backup policy. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Backup policy location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the state of the geo backup policy. Possible values include: 'Disabled', 'Enabled'. + * + * @return the state value + */ + public GeoBackupPolicyState state() { + return this.state; + } + + /** + * Set the state of the geo backup policy. Possible values include: 'Disabled', 'Enabled'. + * + * @param state the state value to set + * @return the GeoBackupPolicyInner object itself. + */ + public GeoBackupPolicyInner withState(GeoBackupPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storage type of the geo backup policy. + * + * @return the storageType value + */ + public String storageType() { + return this.storageType; + } + + /** + * Get kind of geo backup policy. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get backup policy location. + * + * @return the location value + */ + public String location() { + return this.location; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesImpl.java new file mode 100644 index 0000000000000..f86749d871825 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.LocationCapabilities; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.CapabilityStatus; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServerVersionCapability; + +class LocationCapabilitiesImpl extends WrapperImpl implements LocationCapabilities { + private final SqlManager manager; + LocationCapabilitiesImpl(LocationCapabilitiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public CapabilityStatus status() { + return this.inner().status(); + } + + @Override + public List supportedServerVersions() { + return this.inner().supportedServerVersions(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesInner.java new file mode 100644 index 0000000000000..b6e887260e093 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/LocationCapabilitiesInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.CapabilityStatus; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServerVersionCapability; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The capabilities for a location. + */ +public class LocationCapabilitiesInner { + /** + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Azure SQL Database's status for the location. Possible values include: + * 'Visible', 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The list of supported server versions. + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerVersions; + + /** + * Get the location name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get azure SQL Database's status for the location. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the list of supported server versions. + * + * @return the supportedServerVersions value + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java new file mode 100644 index 0000000000000..4a10b9bde796d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java @@ -0,0 +1,100 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.MetricName; +import com.microsoft.azure.management.sql.v2014_04_01.PrimaryAggregationType; +import com.microsoft.azure.management.sql.v2014_04_01.UnitDefinitionType; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.MetricAvailability; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database metric definition. + */ +public class MetricDefinitionInner { + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The primary aggregation type defining how metric values are displayed. + * Possible values include: 'None', 'Average', 'Count', 'Minimum', + * 'Maximum', 'Total'. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /** + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitDefinitionType unit; + + /** + * The list of database metric availabities for the metric. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total'. + * + * @return the primaryAggregationType value + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the resource uri of the database. + * + * @return the resourceUri value + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond'. + * + * @return the unit value + */ + public UnitDefinitionType unit() { + return this.unit; + } + + /** + * Get the list of database metric availabities for the metric. + * + * @return the metricAvailabilities value + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricInner.java new file mode 100644 index 0000000000000..a0c6a6b07f064 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricInner.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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.UnitType; +import com.microsoft.azure.management.sql.v2014_04_01.MetricName; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.MetricValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Database metrics. + */ +public class MetricInner { + /** + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The time step to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The unit of the metric. Possible values include: 'count', 'bytes', + * 'seconds', 'percent', 'countPerSecond', 'bytesPerSecond'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the start time for the metric (ISO-8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the end time for the metric (ISO-8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the time step to be used to summarize the metric values. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit of the metric. Possible values include: 'count', 'bytes', 'seconds', 'percent', 'countPerSecond', 'bytesPerSecond'. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metric values for the specified time window and timestep. + * + * @return the metricValues value + */ + public List metricValues() { + return this.metricValues; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..b43d83575b62b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SQL REST API operation definition. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set display metadata associated with the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultImpl.java new file mode 100644 index 0000000000000..8b256a4da7e81 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultImpl.java @@ -0,0 +1,37 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.OperationListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class OperationListResultImpl extends WrapperImpl implements OperationListResult { + private final SqlManager manager; + OperationListResultImpl(OperationListResultInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultInner.java new file mode 100644 index 0000000000000..efa01e8e437e7 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationListResultInner.java @@ -0,0 +1,71 @@ +/** + * 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.v2014_04_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the request to list SQL operations. It contains a list of + * operations and a URL link to get the next set of results. + */ +public class OperationListResultInner { + /** + * List of SQL operations supported by the SQL resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /** + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get list of SQL operations supported by the SQL resource provider. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of SQL operations supported by the SQL resource provider. + * + * @param value the value value to set + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get uRL to get the next set of operation list results if there are any. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set uRL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..522ec1e9d21d3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.OperationListResult; + +class OperationsImpl extends WrapperImpl implements Operations { + private final SqlManager manager; + + OperationsImpl(SqlManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .map(new Func1() { + @Override + public OperationListResult call(OperationListResultInner inner) { + return new OperationListResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..6d80846d4c71c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/OperationsInner.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.v2014_04_01.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.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Operations list" }) + @GET("providers/Microsoft.Sql/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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 OperationListResultInner object if successful. + */ + public OperationListResultInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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 ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, OperationListResultInner>() { + @Override + public OperationListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesImpl.java new file mode 100644 index 0000000000000..dc157ce0389b4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Queries; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.TopQueries; + +class QueriesImpl extends WrapperImpl implements Queries { + private final SqlManager manager; + + QueriesImpl(SqlManager manager) { + super(manager.inner().queries()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private TopQueriesImpl wrapModel(TopQueriesInner inner) { + return new TopQueriesImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + QueriesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public TopQueries call(TopQueriesInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesInner.java new file mode 100644 index 0000000000000..1cc43f0eeb70b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueriesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Queries. + */ +public class QueriesInner { + /** The Retrofit service to perform REST calls. */ + private QueriesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of QueriesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QueriesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(QueriesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Queries to be + * used by Retrofit to perform actually REST calls. + */ + interface QueriesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Queries listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of top queries by 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. + * @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 List<TopQueriesInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of top queries by 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of top queries by 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TopQueriesInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of top queries by 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TopQueriesInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticImpl.java new file mode 100644 index 0000000000000..c10b2429273ab --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.QueryStatistic; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.QueryInterval; + +class QueryStatisticImpl extends WrapperImpl implements QueryStatistic { + private final SqlManager manager; + + QueryStatisticImpl(QueryStatisticInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public List intervals() { + return this.inner().intervals(); + } + + @Override + public String queryId() { + return this.inner().queryId(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticInner.java new file mode 100644 index 0000000000000..5a9530903a61b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticInner.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.QueryInterval; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database query. + */ +public class QueryStatisticInner { + /** + * The id of the query. + */ + @JsonProperty(value = "queryId", access = JsonProperty.Access.WRITE_ONLY) + private String queryId; + + /** + * The list of query intervals. + */ + @JsonProperty(value = "intervals", access = JsonProperty.Access.WRITE_ONLY) + private List intervals; + + /** + * Get the id of the query. + * + * @return the queryId value + */ + public String queryId() { + return this.queryId; + } + + /** + * Get the list of query intervals. + * + * @return the intervals value + */ + public List intervals() { + return this.intervals; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsImpl.java new file mode 100644 index 0000000000000..7e550f60e4df8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.QueryStatistics; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.QueryStatistic; + +class QueryStatisticsImpl extends WrapperImpl implements QueryStatistics { + private final SqlManager manager; + + QueryStatisticsImpl(SqlManager manager) { + super(manager.inner().queryStatistics()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private QueryStatisticImpl wrapModel(QueryStatisticInner inner) { + return new QueryStatisticImpl(inner, manager()); + } + + @Override + public Observable listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId) { + QueryStatisticsInner client = this.inner(); + return client.listByQueryAsync(resourceGroupName, serverName, databaseName, queryId) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public QueryStatistic call(QueryStatisticInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsInner.java new file mode 100644 index 0000000000000..e7b368c69734d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryStatisticsInner.java @@ -0,0 +1,166 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in QueryStatistics. + */ +public class QueryStatisticsInner { + /** The Retrofit service to perform REST calls. */ + private QueryStatisticsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of QueryStatisticsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QueryStatisticsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(QueryStatisticsService.class); + this.client = client; + } + + /** + * The interface defining all the services for QueryStatistics to be + * used by Retrofit to perform actually REST calls. + */ + interface QueryStatisticsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.QueryStatistics listByQuery" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/statistics") + Observable> listByQuery(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("queryId") String queryId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a query's statistics. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @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 List<QueryStatisticInner> object if successful. + */ + public List listByQuery(String resourceGroupName, String serverName, String databaseName, String queryId) { + return listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId).toBlocking().single().body(); + } + + /** + * Lists a query's statistics. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @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> listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId), serviceCallback); + } + + /** + * Lists a query's statistics. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryStatisticInner> object + */ + public Observable> listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId) { + return listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a query's statistics. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryStatisticInner> object + */ + public Observable>> listByQueryWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String queryId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (queryId == null) { + throw new IllegalArgumentException("Parameter queryId 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.listByQuery(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, queryId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByQueryDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByQueryDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextImpl.java new file mode 100644 index 0000000000000..8b6c078531b61 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.QueryText; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class QueryTextImpl extends WrapperImpl implements QueryText { + private final SqlManager manager; + QueryTextImpl(QueryTextInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String queryText() { + return this.inner().queryText(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextInner.java new file mode 100644 index 0000000000000..aabe606057449 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextInner.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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The QueryTextInner model. + */ +public class QueryTextInner { + /** + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Query text. + */ + @JsonProperty(value = "queryText", access = JsonProperty.Access.WRITE_ONLY) + private String queryText; + + /** + * Get resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get query text. + * + * @return the queryText value + */ + public String queryText() { + return this.queryText; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsImpl.java new file mode 100644 index 0000000000000..d025d9127797f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.QueryTexts; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.QueryText; + +class QueryTextsImpl extends WrapperImpl implements QueryTexts { + private final SqlManager manager; + + QueryTextsImpl(SqlManager manager) { + super(manager.inner().queryTexts()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId) { + QueryTextsInner client = this.inner(); + return client.listByQueryAsync(resourceGroupName, serverName, databaseName, queryId) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public QueryText call(QueryTextInner inner) { + return new QueryTextImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsInner.java new file mode 100644 index 0000000000000..d0245af14c2fc --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/QueryTextsInner.java @@ -0,0 +1,166 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in QueryTexts. + */ +public class QueryTextsInner { + /** The Retrofit service to perform REST calls. */ + private QueryTextsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of QueryTextsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QueryTextsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(QueryTextsService.class); + this.client = client; + } + + /** + * The interface defining all the services for QueryTexts to be + * used by Retrofit to perform actually REST calls. + */ + interface QueryTextsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.QueryTexts listByQuery" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/queryText") + Observable> listByQuery(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("queryId") String queryId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a query's text. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @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 List<QueryTextInner> object if successful. + */ + public List listByQuery(String resourceGroupName, String serverName, String databaseName, String queryId) { + return listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId).toBlocking().single().body(); + } + + /** + * Gets a query's text. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @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> listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId), serviceCallback); + } + + /** + * Gets a query's text. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryTextInner> object + */ + public Observable> listByQueryAsync(String resourceGroupName, String serverName, String databaseName, String queryId) { + return listByQueryWithServiceResponseAsync(resourceGroupName, serverName, databaseName, queryId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a query's text. + * + * @param resourceGroupName The 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. + * @param queryId The id of the query + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryTextInner> object + */ + public Observable>> listByQueryWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String queryId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (queryId == null) { + throw new IllegalArgumentException("Parameter queryId 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.listByQuery(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, queryId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByQueryDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByQueryDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseImpl.java new file mode 100644 index 0000000000000..9daa1d95e729c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RecoverableDatabase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class RecoverableDatabaseImpl extends IndexableRefreshableWrapperImpl implements RecoverableDatabase { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + RecoverableDatabaseImpl(RecoverableDatabaseInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "recoverableDatabases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecoverableDatabasesInner client = this.manager().inner().recoverableDatabases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + + + @Override + public String edition() { + return this.inner().edition(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastAvailableBackupDate() { + return this.inner().lastAvailableBackupDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceLevelObjective() { + return this.inner().serviceLevelObjective(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseInner.java new file mode 100644 index 0000000000000..f2ed62bc08a3b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabaseInner.java @@ -0,0 +1,81 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A recoverable database. + */ +@JsonFlatten +public class RecoverableDatabaseInner extends ProxyResource { + /** + * The edition of the database. + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /** + * The service level objective name of the database. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /** + * The elastic pool name of the database. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The last available backup date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.lastAvailableBackupDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastAvailableBackupDate; + + /** + * Get the edition of the database. + * + * @return the edition value + */ + public String edition() { + return this.edition; + } + + /** + * Get the service level objective name of the database. + * + * @return the serviceLevelObjective value + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the elastic pool name of the database. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value + */ + public DateTime lastAvailableBackupDate() { + return this.lastAvailableBackupDate; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesImpl.java new file mode 100644 index 0000000000000..79e5cd554872c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.RecoverableDatabases; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RecoverableDatabase; + +class RecoverableDatabasesImpl extends WrapperImpl implements RecoverableDatabases { + private final SqlManager manager; + + RecoverableDatabasesImpl(SqlManager manager) { + super(manager.inner().recoverableDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RecoverableDatabaseImpl wrapModel(RecoverableDatabaseInner inner) { + return new RecoverableDatabaseImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + RecoverableDatabasesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecoverableDatabase call(RecoverableDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + RecoverableDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public RecoverableDatabase call(RecoverableDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java new file mode 100644 index 0000000000000..ead556f2b65ac --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecoverableDatabasesInner.java @@ -0,0 +1,249 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RecoverableDatabases. + */ +public class RecoverableDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private RecoverableDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecoverableDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecoverableDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecoverableDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface RecoverableDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.RecoverableDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2014_04_01.RecoverableDatabases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases") + 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); + + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @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 RecoverableDatabaseInner object if successful. + */ + public RecoverableDatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @param databaseName The name of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecoverableDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, RecoverableDatabaseInner>() { + @Override + public RecoverableDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @param databaseName The name of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecoverableDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, 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 recoverable 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 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 List<RecoverableDatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of recoverable 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 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of recoverable 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecoverableDatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of recoverable 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecoverableDatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseImpl.java new file mode 100644 index 0000000000000..cf1df8f0d4ad4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseImpl.java @@ -0,0 +1,103 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RestorableDroppedDatabase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class RestorableDroppedDatabaseImpl extends IndexableRefreshableWrapperImpl implements RestorableDroppedDatabase { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String restorableDroppededDatabaseId; + + RestorableDroppedDatabaseImpl(RestorableDroppedDatabaseInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.restorableDroppededDatabaseId = IdParsingUtils.getValueFromIdByName(inner.id(), "restorableDroppedDatabases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RestorableDroppedDatabasesInner client = this.manager().inner().restorableDroppedDatabases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.restorableDroppededDatabaseId); + } + + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public DateTime deletionDate() { + return this.inner().deletionDate(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String edition() { + return this.inner().edition(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceLevelObjective() { + return this.inner().serviceLevelObjective(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseInner.java new file mode 100644 index 0000000000000..9279b21062942 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabaseInner.java @@ -0,0 +1,156 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A restorable dropped database. + */ +@JsonFlatten +public class RestorableDroppedDatabaseInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The edition of the database. + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /** + * The max size in bytes of the database. + */ + @JsonProperty(value = "properties.maxSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private String maxSizeBytes; + + /** + * The service level objective name of the database. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /** + * The elastic pool name of the database. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deletionDate; + + /** + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the name of the database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the edition of the database. + * + * @return the edition value + */ + public String edition() { + return this.edition; + } + + /** + * Get the max size in bytes of the database. + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Get the service level objective name of the database. + * + * @return the serviceLevelObjective value + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the elastic pool name of the database. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletion date of the database (ISO8601 format). + * + * @return the deletionDate value + */ + public DateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesImpl.java new file mode 100644 index 0000000000000..28b558da080d2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.RestorableDroppedDatabases; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RestorableDroppedDatabase; + +class RestorableDroppedDatabasesImpl extends WrapperImpl implements RestorableDroppedDatabases { + private final SqlManager manager; + + RestorableDroppedDatabasesImpl(SqlManager manager) { + super(manager.inner().restorableDroppedDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RestorableDroppedDatabaseImpl wrapModel(RestorableDroppedDatabaseInner inner) { + return new RestorableDroppedDatabaseImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + RestorableDroppedDatabasesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RestorableDroppedDatabase call(RestorableDroppedDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + RestorableDroppedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, restorableDroppededDatabaseId) + .map(new Func1() { + @Override + public RestorableDroppedDatabase call(RestorableDroppedDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java new file mode 100644 index 0000000000000..93a7d3cc09d96 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java @@ -0,0 +1,249 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RestorableDroppedDatabases. + */ +public class RestorableDroppedDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private RestorableDroppedDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RestorableDroppedDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RestorableDroppedDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RestorableDroppedDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface RestorableDroppedDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.RestorableDroppedDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("restorableDroppededDatabaseId") String restorableDroppededDatabaseId, @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.v2014_04_01.RestorableDroppedDatabases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases") + 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); + + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @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 RestorableDroppedDatabaseInner object if successful. + */ + public RestorableDroppedDatabaseInner get(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).toBlocking().single().body(); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @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 restorableDroppededDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId), serviceCallback); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).map(new Func1, RestorableDroppedDatabaseInner>() { + @Override + public RestorableDroppedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + 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 (restorableDroppededDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppededDatabaseId 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(this.client.subscriptionId(), resourceGroupName, serverName, restorableDroppededDatabaseId, 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 deleted databases that can be restored. + * + * @param resourceGroupName The 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 List<RestorableDroppedDatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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 List<RestorableDroppedDatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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 List<RestorableDroppedDatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointImpl.java new file mode 100644 index 0000000000000..fcb5abf6accb5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RestorePoint; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.RestorePointType; + +class RestorePointImpl extends WrapperImpl implements RestorePoint { + private final SqlManager manager; + + RestorePointImpl(RestorePointInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime restorePointCreationDate() { + return this.inner().restorePointCreationDate(); + } + + @Override + public RestorePointType restorePointType() { + return this.inner().restorePointType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointInner.java new file mode 100644 index 0000000000000..0d2b374951725 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RestorePointType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database restore point. + */ +@JsonFlatten +public class RestorePointInner extends ProxyResource { + /** + * The restore point type of the database restore point. Possible values + * include: 'DISCRETE', 'CONTINUOUS'. + */ + @JsonProperty(value = "properties.restorePointType", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointType restorePointType; + + /** + * Restore point creation time (ISO8601 format). Populated when + * restorePointType = CONTINUOUS. Null otherwise. + */ + @JsonProperty(value = "properties.restorePointCreationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime restorePointCreationDate; + + /** + * Earliest restore time (ISO8601 format). Populated when restorePointType + * = DISCRETE. Null otherwise. + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Get the restore point type of the database restore point. Possible values include: 'DISCRETE', 'CONTINUOUS'. + * + * @return the restorePointType value + */ + public RestorePointType restorePointType() { + return this.restorePointType; + } + + /** + * Get restore point creation time (ISO8601 format). Populated when restorePointType = CONTINUOUS. Null otherwise. + * + * @return the restorePointCreationDate value + */ + public DateTime restorePointCreationDate() { + return this.restorePointCreationDate; + } + + /** + * Get earliest restore time (ISO8601 format). Populated when restorePointType = DISCRETE. Null otherwise. + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsImpl.java new file mode 100644 index 0000000000000..0402926ee789e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.RestorePoints; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RestorePoint; + +class RestorePointsImpl extends WrapperImpl implements RestorePoints { + private final SqlManager manager; + + RestorePointsImpl(SqlManager manager) { + super(manager.inner().restorePoints()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RestorePointImpl wrapModel(RestorePointInner inner) { + return new RestorePointImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + RestorePointsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RestorePoint call(RestorePointInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsInner.java new file mode 100644 index 0000000000000..6abee07c5f654 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RestorePoints. + */ +public class RestorePointsInner { + /** The Retrofit service to perform REST calls. */ + private RestorePointsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorePointsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RestorePointsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RestorePointsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RestorePoints to be + * used by Retrofit to perform actually REST calls. + */ + interface RestorePointsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.RestorePoints listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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 get available restore points. + * @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 List<RestorePointInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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 get available restore points. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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 get available restore points. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RestorePointInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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 get available restore points. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RestorePointInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorImpl.java new file mode 100644 index 0000000000000..2a5a3ee7a3f3e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerAdvisor; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.AutoExecuteStatus; +import com.microsoft.azure.management.sql.v2014_04_01.AdvisorStatus; +import org.joda.time.DateTime; + +class ServerAdvisorImpl extends CreatableUpdatableImpl implements ServerAdvisor, ServerAdvisor.Definition, ServerAdvisor.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String advisorName; + private AutoExecuteStatus cautoExecuteValue; + private AutoExecuteStatus uautoExecuteValue; + + ServerAdvisorImpl(String name, SqlManager manager) { + super(name, new AdvisorInner()); + this.manager = manager; + // Set resource name + this.advisorName = name; + // + } + + ServerAdvisorImpl(AdvisorInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.advisorName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.advisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "advisors"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerAdvisorsInner client = this.manager().inner().serverAdvisors(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.advisorName, this.cautoExecuteValue) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerAdvisorsInner client = this.manager().inner().serverAdvisors(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.advisorName, this.uautoExecuteValue) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerAdvisorsInner client = this.manager().inner().serverAdvisors(); + return client.getAsync(this.resourceGroupName, this.serverName, this.advisorName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AdvisorStatus advisorStatus() { + return this.inner().advisorStatus(); + } + + @Override + public AutoExecuteStatus autoExecuteValue() { + return this.inner().autoExecuteValue(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DateTime lastChecked() { + return this.inner().lastChecked(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recommendationsStatus() { + return this.inner().recommendationsStatus(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerAdvisorImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerAdvisorImpl withAutoExecuteValue(AutoExecuteStatus autoExecuteValue) { + if (isInCreateMode()) { + this.cautoExecuteValue = autoExecuteValue; + } else { + this.uautoExecuteValue = autoExecuteValue; + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsImpl.java new file mode 100644 index 0000000000000..67cb2c2f9ae76 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServerAdvisors; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.AdvisorListResult; +import com.microsoft.azure.management.sql.v2014_04_01.ServerAdvisor; + +class ServerAdvisorsImpl extends WrapperImpl implements ServerAdvisors { + private final SqlManager manager; + + ServerAdvisorsImpl(SqlManager manager) { + super(manager.inner().serverAdvisors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerAdvisorImpl define(String name) { + return wrapModel(name); + } + + private ServerAdvisorImpl wrapModel(AdvisorInner inner) { + return new ServerAdvisorImpl(inner, manager()); + } + + private ServerAdvisorImpl wrapModel(String name) { + return new ServerAdvisorImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerAdvisorsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public AdvisorListResult call(AdvisorListResultInner inner) { + return new AdvisorListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String advisorName) { + ServerAdvisorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, advisorName) + .map(new Func1() { + @Override + public ServerAdvisor call(AdvisorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java new file mode 100644 index 0000000000000..80d4820e88f6e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java @@ -0,0 +1,459 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.AutoExecuteStatus; +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.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +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 ServerAdvisors. + */ +public class ServerAdvisorsInner { + /** The Retrofit service to perform REST calls. */ + private ServerAdvisorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAdvisorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerAdvisorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerAdvisorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerAdvisors to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerAdvisorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerAdvisors listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors") + 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.v2014_04_01.ServerAdvisors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("advisorName") String advisorName, @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.v2014_04_01.ServerAdvisors update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("advisorName") String advisorName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AdvisorInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerAdvisors createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("advisorName") String advisorName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AdvisorInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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 AdvisorListResultInner object if successful. + */ + public AdvisorListResultInner listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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 AdvisorListResultInner object + */ + public Observable listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, AdvisorListResultInner>() { + @Override + public AdvisorListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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 AdvisorListResultInner object + */ + public Observable> listByServerWithServiceResponseAsync(String resourceGroupName, 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 clientResponse = listByServerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByServerDelegate(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 server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @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 AdvisorInner object if successful. + */ + public AdvisorInner get(String resourceGroupName, String serverName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, advisorName).toBlocking().single().body(); + } + + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @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 advisorName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, advisorName), serviceCallback); + } + + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, advisorName).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String advisorName) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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, advisorName, 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); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 AdvisorInner object if successful. + */ + public AdvisorInner update(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue).toBlocking().single().body(); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 serverName, String advisorName, AutoExecuteStatus autoExecuteValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue), serviceCallback); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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 (autoExecuteValue == null) { + throw new IllegalArgumentException("Parameter autoExecuteValue is required and cannot be null."); + } + AdvisorInner parameters = new AdvisorInner(); + parameters.withAutoExecuteValue(autoExecuteValue); + return service.update(resourceGroupName, serverName, advisorName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 AdvisorInner object if successful. + */ + public AdvisorInner createOrUpdate(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue).toBlocking().single().body(); + } + + /** + * Creates or updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 advisorName, AutoExecuteStatus autoExecuteValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue), serviceCallback); + } + + /** + * Creates or updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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 (autoExecuteValue == null) { + throw new IllegalArgumentException("Parameter autoExecuteValue is required and cannot be null."); + } + AdvisorInner parameters = new AdvisorInner(); + parameters.withAutoExecuteValue(autoExecuteValue); + return service.createOrUpdate(resourceGroupName, serverName, advisorName, 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 = 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()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorImpl.java new file mode 100644 index 0000000000000..d3ba4de3f3b23 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.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(); + // resource ancestor names + 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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorInner.java new file mode 100644 index 0000000000000..6bf45e3a20974 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorInner.java @@ -0,0 +1,135 @@ +/** + * 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.v2014_04_01.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An server Active Directory Administrator. + */ +@JsonFlatten +public class ServerAzureADAdministratorInner extends ProxyResource { + /** + * The type of administrator. + */ + @JsonProperty(value = "properties.administratorType", required = true) + private String administratorType; + + /** + * The server administrator login value. + */ + @JsonProperty(value = "properties.login", required = true) + private String login; + + /** + * The server administrator Sid (Secure ID). + */ + @JsonProperty(value = "properties.sid", required = true) + private UUID sid; + + /** + * The server Active Directory Administrator tenant id. + */ + @JsonProperty(value = "properties.tenantId", required = true) + private UUID tenantId; + + /** + * Creates an instance of ServerAzureADAdministratorInner class. + * @param login the server administrator login value. + * @param sid the server administrator Sid (Secure ID). + * @param tenantId the server Active Directory Administrator tenant id. + */ + public ServerAzureADAdministratorInner() { + administratorType = "ActiveDirectory"; + } + + /** + * Get the type of administrator. + * + * @return the administratorType value + */ + public String administratorType() { + return this.administratorType; + } + + /** + * Set the type of administrator. + * + * @param administratorType the administratorType value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withAdministratorType(String administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the server administrator login value. + * + * @return the login value + */ + public String login() { + return this.login; + } + + /** + * Set the server administrator login value. + * + * @param login the login value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the server administrator Sid (Secure ID). + * + * @return the sid value + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the server administrator Sid (Secure ID). + * + * @param sid the sid value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the server Active Directory Administrator tenant id. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the server Active Directory Administrator tenant id. + * + * @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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsImpl.java new file mode 100644 index 0000000000000..4637cfe828d1e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServerAzureADAdministrators; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServerAzureADAdministrator; + +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 define(String name) { + return wrapModel(name); + } + + private ServerAzureADAdministratorImpl wrapModel(ServerAzureADAdministratorInner inner) { + return new ServerAzureADAdministratorImpl(inner, manager()); + } + + private ServerAzureADAdministratorImpl wrapModel(String name) { + return new ServerAzureADAdministratorImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServerAzureADAdministrator call(ServerAzureADAdministratorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerAzureADAdministrator call(ServerAzureADAdministratorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java new file mode 100644 index 0000000000000..3416e2255f937 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java @@ -0,0 +1,598 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +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 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.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.v2014_04_01.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 properties, @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.v2014_04_01.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 properties, @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.v2014_04_01.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.v2014_04_01.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.v2014_04_01.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.v2014_04_01.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); + + } + + /** + * 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 properties 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 properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties), 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 properties 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 properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties) { + 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 (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String administratorName = "activeDirectory"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), properties, 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 properties 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 properties) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties), 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 properties 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 properties) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties) { + 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 (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String administratorName = "activeDirectory"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), properties, 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 + * @return the ServerAzureADAdministratorInner object if successful. + */ + public ServerAzureADAdministratorInner delete(String resourceGroupName, String serverName) { + return 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, ServerAzureADAdministratorInner>() { + @Override + public ServerAzureADAdministratorInner 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 + * @return the ServerAzureADAdministratorInner object if successful. + */ + public ServerAzureADAdministratorInner beginDelete(String resourceGroupName, String serverName) { + return 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 observable to the ServerAzureADAdministratorInner object + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerAzureADAdministratorInner>() { + @Override + public ServerAzureADAdministratorInner 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 to the ServerAzureADAdministratorInner object + */ + 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); + } + + /** + * Returns an 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(); + } + + /** + * Returns an 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); + } + + /** + * Returns an 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(); + } + }); + } + + /** + * Returns an 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); + } + + /** + * Returns 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 List<ServerAzureADAdministratorInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns 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 List<ServerAzureADAdministratorInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns 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 List<ServerAzureADAdministratorInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkImpl.java new file mode 100644 index 0000000000000..72b6ff0208309 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkImpl.java @@ -0,0 +1,126 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerCommunicationLink; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ServerCommunicationLinkImpl extends CreatableUpdatableImpl implements ServerCommunicationLink, ServerCommunicationLink.Definition, ServerCommunicationLink.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String communicationLinkName; + private String cpartnerServer; + private String upartnerServer; + + ServerCommunicationLinkImpl(String name, SqlManager manager) { + super(name, new ServerCommunicationLinkInner()); + this.manager = manager; + // Set resource name + this.communicationLinkName = name; + // + } + + ServerCommunicationLinkImpl(ServerCommunicationLinkInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.communicationLinkName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.communicationLinkName = IdParsingUtils.getValueFromIdByName(inner.id(), "communicationLinks"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerCommunicationLinksInner client = this.manager().inner().serverCommunicationLinks(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.communicationLinkName, this.cpartnerServer) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerCommunicationLinksInner client = this.manager().inner().serverCommunicationLinks(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.communicationLinkName, this.upartnerServer) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerCommunicationLinksInner client = this.manager().inner().serverCommunicationLinks(); + return client.getAsync(this.resourceGroupName, this.serverName, this.communicationLinkName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerServer() { + return this.inner().partnerServer(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerCommunicationLinkImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerCommunicationLinkImpl withPartnerServer(String partnerServer) { + if (isInCreateMode()) { + this.cpartnerServer = partnerServer; + } else { + this.upartnerServer = partnerServer; + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkInner.java new file mode 100644 index 0000000000000..b5212f6a77c61 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinkInner.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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Server communication link. + */ +@JsonFlatten +public class ServerCommunicationLinkInner extends ProxyResource { + /** + * The state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The name of the partner server. + */ + @JsonProperty(value = "properties.partnerServer", required = true) + private String partnerServer; + + /** + * Communication link location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Communication link kind. This property is used for Azure Portal + * metadata. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the state. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the name of the partner server. + * + * @return the partnerServer value + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Set the name of the partner server. + * + * @param partnerServer the partnerServer value to set + * @return the ServerCommunicationLinkInner object itself. + */ + public ServerCommunicationLinkInner withPartnerServer(String partnerServer) { + this.partnerServer = partnerServer; + return this; + } + + /** + * Get communication link location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get communication link kind. This property is used for Azure Portal metadata. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksImpl.java new file mode 100644 index 0000000000000..89157bcd67b33 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServerCommunicationLinks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServerCommunicationLink; + +class ServerCommunicationLinksImpl extends WrapperImpl implements ServerCommunicationLinks { + private final SqlManager manager; + + ServerCommunicationLinksImpl(SqlManager manager) { + super(manager.inner().serverCommunicationLinks()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerCommunicationLinkImpl define(String name) { + return wrapModel(name); + } + + private ServerCommunicationLinkImpl wrapModel(ServerCommunicationLinkInner inner) { + return new ServerCommunicationLinkImpl(inner, manager()); + } + + private ServerCommunicationLinkImpl wrapModel(String name) { + return new ServerCommunicationLinkImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerCommunicationLinksInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServerCommunicationLink call(ServerCommunicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String communicationLinkName) { + ServerCommunicationLinksInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, communicationLinkName) + .map(new Func1() { + @Override + public ServerCommunicationLink call(ServerCommunicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String communicationLinkName) { + ServerCommunicationLinksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, communicationLinkName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java new file mode 100644 index 0000000000000..f10496caa9a8b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java @@ -0,0 +1,544 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerCommunicationLinks. + */ +public class ServerCommunicationLinksInner { + /** The Retrofit service to perform REST calls. */ + private ServerCommunicationLinksService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerCommunicationLinksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerCommunicationLinksInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerCommunicationLinksService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerCommunicationLinks to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerCommunicationLinksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerCommunicationLinks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @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.v2014_04_01.ServerCommunicationLinks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @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.v2014_04_01.ServerCommunicationLinks createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerCommunicationLinkInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerCommunicationLinks beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerCommunicationLinkInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerCommunicationLinks listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks") + 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); + + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 communicationLinkName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).toBlocking().single().body(); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 communicationLinkName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName), serviceCallback); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String communicationLinkName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, 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); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 ServerCommunicationLinkInner object if successful. + */ + public ServerCommunicationLinkInner get(String resourceGroupName, String serverName, String communicationLinkName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).toBlocking().single().body(); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 communicationLinkName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName), serviceCallback); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String communicationLinkName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).map(new Func1, ServerCommunicationLinkInner>() { + @Override + public ServerCommunicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, 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 server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 ServerCommunicationLinkInner object if successful. + */ + public ServerCommunicationLinkInner createOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().last().body(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 createOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer), serviceCallback); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).map(new Func1, ServerCommunicationLinkInner>() { + @Override + public ServerCommunicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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 (partnerServer == null) { + throw new IllegalArgumentException("Parameter partnerServer is required and cannot be null."); + } + ServerCommunicationLinkInner parameters = new ServerCommunicationLinkInner(); + parameters.withPartnerServer(partnerServer); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 ServerCommunicationLinkInner object if successful. + */ + public ServerCommunicationLinkInner beginCreateOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().single().body(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer), serviceCallback); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).map(new Func1, ServerCommunicationLinkInner>() { + @Override + public ServerCommunicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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 (partnerServer == null) { + throw new IllegalArgumentException("Parameter partnerServer is required and cannot be null."); + } + ServerCommunicationLinkInner parameters = new ServerCommunicationLinkInner(); + parameters.withPartnerServer(partnerServer); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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 List<ServerCommunicationLinkInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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 List<ServerCommunicationLinkInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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 List<ServerCommunicationLinkInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesImpl.java new file mode 100644 index 0000000000000..b6f5ec57cb4f6 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionPolicy; + +class ServerConnectionPoliciesImpl extends WrapperImpl implements ServerConnectionPolicies { + private final SqlManager manager; + + ServerConnectionPoliciesImpl(SqlManager manager) { + super(manager.inner().serverConnectionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerConnectionPolicyImpl define(String name) { + return wrapModel(name); + } + + private ServerConnectionPolicyImpl wrapModel(ServerConnectionPolicyInner inner) { + return new ServerConnectionPolicyImpl(inner, manager()); + } + + private ServerConnectionPolicyImpl wrapModel(String name) { + return new ServerConnectionPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerConnectionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerConnectionPolicy call(ServerConnectionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesInner.java new file mode 100644 index 0000000000000..a45cd28add01b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesInner.java @@ -0,0 +1,251 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionType; +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.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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerConnectionPolicies. + */ +public class ServerConnectionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ServerConnectionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerConnectionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerConnectionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerConnectionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerConnectionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerConnectionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("connectionPolicyName") String connectionPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerConnectionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("connectionPolicyName") String connectionPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @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 ServerConnectionPolicyInner object if successful. + */ + public ServerConnectionPolicyInner createOrUpdate(String resourceGroupName, String serverName, ServerConnectionType connectionType) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType).toBlocking().single().body(); + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @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, ServerConnectionType connectionType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType), serviceCallback); + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerConnectionType connectionType) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType).map(new Func1, ServerConnectionPolicyInner>() { + @Override + public ServerConnectionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerConnectionType connectionType) { + 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 (connectionType == null) { + throw new IllegalArgumentException("Parameter connectionType is required and cannot be null."); + } + final String connectionPolicyName = "default"; + ServerConnectionPolicyInner parameters = new ServerConnectionPolicyInner(); + parameters.withConnectionType(connectionType); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, connectionPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 the server's secure connection 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. + * @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 ServerConnectionPolicyInner object if successful. + */ + public ServerConnectionPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets the server's secure connection 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 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 the server's secure connection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerConnectionPolicyInner>() { + @Override + public ServerConnectionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the server's secure connection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner 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 connectionPolicyName = "default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, connectionPolicyName, 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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyImpl.java new file mode 100644 index 0000000000000..2eeba92ea7f51 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyImpl.java @@ -0,0 +1,120 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionType; + +class ServerConnectionPolicyImpl extends CreatableUpdatableImpl implements ServerConnectionPolicy, ServerConnectionPolicy.Definition, ServerConnectionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private ServerConnectionType cconnectionType; + private ServerConnectionType uconnectionType; + + ServerConnectionPolicyImpl(String name, SqlManager manager) { + super(name, new ServerConnectionPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerConnectionPolicyImpl(ServerConnectionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerConnectionPoliciesInner client = this.manager().inner().serverConnectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.cconnectionType) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerConnectionPoliciesInner client = this.manager().inner().serverConnectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.uconnectionType) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerConnectionPoliciesInner client = this.manager().inner().serverConnectionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public ServerConnectionType connectionType() { + return this.inner().connectionType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerConnectionPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerConnectionPolicyImpl withConnectionType(ServerConnectionType connectionType) { + if (isInCreateMode()) { + this.cconnectionType = connectionType; + } else { + this.uconnectionType = connectionType; + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyInner.java new file mode 100644 index 0000000000000..5c89e5e309026 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPolicyInner.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server secure connection policy. + */ +@JsonFlatten +public class ServerConnectionPolicyInner extends ProxyResource { + /** + * Metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The server connection type. Possible values include: 'Default', 'Proxy', + * 'Redirect'. + */ + @JsonProperty(value = "properties.connectionType", required = true) + private ServerConnectionType connectionType; + + /** + * Get metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the server connection type. Possible values include: 'Default', 'Proxy', 'Redirect'. + * + * @return the connectionType value + */ + public ServerConnectionType connectionType() { + return this.connectionType; + } + + /** + * Set the server connection type. Possible values include: 'Default', 'Proxy', 'Redirect'. + * + * @param connectionType the connectionType value to set + * @return the ServerConnectionPolicyInner object itself. + */ + public ServerConnectionPolicyInner withConnectionType(ServerConnectionType connectionType) { + this.connectionType = connectionType; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerImpl.java new file mode 100644 index 0000000000000..7d2a270fc346e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerImpl.java @@ -0,0 +1,140 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Server; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ServerUpdate; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2014_04_01.ServerVersion; +import com.microsoft.azure.management.sql.v2014_04_01.ServerState; +import rx.functions.Func1; + +class ServerImpl extends GroupableResourceCoreImpl implements Server, Server.Definition, Server.Update { + private ServerUpdate updateParameter; + ServerImpl(String name, ServerInner inner, SqlManager manager) { + super(name, inner, manager); + this.updateParameter = new ServerUpdate(); + } + + @Override + public Observable createResourceAsync() { + ServersInner client = this.manager().inner().servers(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ServerInner call(ServerInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServersInner client = this.manager().inner().servers(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ServerInner call(ServerInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServersInner client = this.manager().inner().servers(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ServerUpdate(); + } + + @Override + public String administratorLogin() { + return this.inner().administratorLogin(); + } + + @Override + public String administratorLoginPassword() { + return this.inner().administratorLoginPassword(); + } + + @Override + public String externalAdministratorLogin() { + return this.inner().externalAdministratorLogin(); + } + + @Override + public UUID externalAdministratorSid() { + return this.inner().externalAdministratorSid(); + } + + @Override + public String fullyQualifiedDomainName() { + return this.inner().fullyQualifiedDomainName(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public ServerState state() { + return this.inner().state(); + } + + @Override + public ServerVersion version() { + return this.inner().version(); + } + + @Override + public ServerImpl withAdministratorLogin(String administratorLogin) { + if (isInCreateMode()) { + this.inner().withAdministratorLogin(administratorLogin); + } else { + this.updateParameter.withAdministratorLogin(administratorLogin); + } + return this; + } + + @Override + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.inner().withAdministratorLoginPassword(administratorLoginPassword); + } else { + this.updateParameter.withAdministratorLoginPassword(administratorLoginPassword); + } + return this; + } + + @Override + public ServerImpl withVersion(ServerVersion version) { + if (isInCreateMode()) { + this.inner().withVersion(version); + } else { + this.updateParameter.withVersion(version); + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerInner.java new file mode 100644 index 0000000000000..5f8047bc478e0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerInner.java @@ -0,0 +1,182 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerVersion; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2014_04_01.ServerState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Represents a server. + */ +@JsonFlatten +public class ServerInner extends Resource { + /** + * Kind of sql server. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * The version of the server. Possible values include: '2.0', '12.0'. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /** + * Administrator username for the server. Can only be specified when the + * server is being created (and is required for creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The ID of the Active Azure Directory object with admin permissions on + * this server. Legacy parameter, always null. To check for Active + * Directory admin, query .../servers/{serverName}/administrators. + */ + @JsonProperty(value = "properties.externalAdministratorSid", access = JsonProperty.Access.WRITE_ONLY) + private UUID externalAdministratorSid; + + /** + * The display name of the Azure Active Directory object with admin + * permissions on this server. Legacy parameter, always null. To check for + * Active Directory admin, query .../servers/{serverName}/administrators. + */ + @JsonProperty(value = "properties.externalAdministratorLogin", access = JsonProperty.Access.WRITE_ONLY) + private String externalAdministratorLogin; + + /** + * The state of the server. Possible values include: 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ServerState state; + + /** + * Get kind of sql server. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the version of the server. Possible values include: '2.0', '12.0'. + * + * @return the version value + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version of the server. Possible values include: '2.0', '12.0'. + * + * @param version the version value to set + * @return the ServerInner object itself. + */ + public ServerInner withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get administrator username for the server. Can only be specified when the server is being created (and is required for creation). + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the server. Can only be specified when the server is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for server creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the ID of the Active Azure Directory object with admin permissions on this server. Legacy parameter, always null. To check for Active Directory admin, query .../servers/{serverName}/administrators. + * + * @return the externalAdministratorSid value + */ + public UUID externalAdministratorSid() { + return this.externalAdministratorSid; + } + + /** + * Get the display name of the Azure Active Directory object with admin permissions on this server. Legacy parameter, always null. To check for Active Directory admin, query .../servers/{serverName}/administrators. + * + * @return the externalAdministratorLogin value + */ + public String externalAdministratorLogin() { + return this.externalAdministratorLogin; + } + + /** + * Get the state of the server. Possible values include: 'Ready', 'Disabled'. + * + * @return the state value + */ + public ServerState state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..7c0ab0e1cfd2a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServerTableAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.ServerTableAuditingPolicyListResult; +import com.microsoft.azure.management.sql.v2014_04_01.ServerTableAuditingPolicy; + +class ServerTableAuditingPoliciesImpl extends WrapperImpl implements ServerTableAuditingPolicies { + private final SqlManager manager; + + ServerTableAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().serverTableAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerTableAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private ServerTableAuditingPolicyImpl wrapModel(ServerTableAuditingPolicyInner inner) { + return new ServerTableAuditingPolicyImpl(inner, manager()); + } + + private ServerTableAuditingPolicyImpl wrapModel(String name) { + return new ServerTableAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerTableAuditingPoliciesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerTableAuditingPolicyListResult call(ServerTableAuditingPolicyListResultInner inner) { + return new ServerTableAuditingPolicyListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerTableAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerTableAuditingPolicy call(ServerTableAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java new file mode 100644 index 0000000000000..6d1337ed14e05 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java @@ -0,0 +1,340 @@ +/** + * 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.v2014_04_01.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerTableAuditingPolicies. + */ +public class ServerTableAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ServerTableAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerTableAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerTableAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerTableAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerTableAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerTableAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerTableAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingPolicies/{tableAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("tableAuditingPolicyName") String tableAuditingPolicyName, @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.v2014_04_01.ServerTableAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingPolicies/{tableAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("tableAuditingPolicyName") String tableAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerTableAuditingPolicyInner 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.v2014_04_01.ServerTableAuditingPolicies listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingPolicies") + 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); + + } + + /** + * Gets a server's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 ServerTableAuditingPolicyInner object if successful. + */ + public ServerTableAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a server's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 ServerTableAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerTableAuditingPolicyInner>() { + @Override + public ServerTableAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 ServerTableAuditingPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String tableAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, tableAuditingPolicyName, 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 servers's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 server table auditing 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 ServerTableAuditingPolicyInner object if successful. + */ + public ServerTableAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, ServerTableAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a servers's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 server table auditing 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, ServerTableAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a servers's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 server table auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerTableAuditingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerTableAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerTableAuditingPolicyInner>() { + @Override + public ServerTableAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a servers's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 server table auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerTableAuditingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerTableAuditingPolicyInner 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 (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 tableAuditingPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, tableAuditingPolicyName, 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); + } + + /** + * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 ServerTableAuditingPolicyListResultInner object if successful. + */ + public ServerTableAuditingPolicyListResultInner listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 ServerTableAuditingPolicyListResultInner object + */ + public Observable listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerTableAuditingPolicyListResultInner>() { + @Override + public ServerTableAuditingPolicyListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * + * @param resourceGroupName The 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 ServerTableAuditingPolicyListResultInner object + */ + public Observable> listByServerWithServiceResponseAsync(String resourceGroupName, 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 clientResponse = listByServerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByServerDelegate(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/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyImpl.java new file mode 100644 index 0000000000000..61bc1eccaf189 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyImpl.java @@ -0,0 +1,224 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerTableAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.UUID; + +class ServerTableAuditingPolicyImpl extends CreatableUpdatableImpl implements ServerTableAuditingPolicy, ServerTableAuditingPolicy.Definition, ServerTableAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerTableAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new ServerTableAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerTableAuditingPolicyImpl(ServerTableAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerTableAuditingPoliciesInner client = this.manager().inner().serverTableAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerTableAuditingPoliciesInner client = this.manager().inner().serverTableAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerTableAuditingPoliciesInner client = this.manager().inner().serverTableAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String auditingState() { + return this.inner().auditingState(); + } + + @Override + public String auditLogsTableName() { + return this.inner().auditLogsTableName(); + } + + @Override + public String eventTypesToAudit() { + return this.inner().eventTypesToAudit(); + } + + @Override + public String fullAuditLogsTableName() { + return this.inner().fullAuditLogsTableName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String storageAccountKey() { + return this.inner().storageAccountKey(); + } + + @Override + public String storageAccountName() { + return this.inner().storageAccountName(); + } + + @Override + public String storageAccountResourceGroupName() { + return this.inner().storageAccountResourceGroupName(); + } + + @Override + public String storageAccountSecondaryKey() { + return this.inner().storageAccountSecondaryKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageTableEndpoint() { + return this.inner().storageTableEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerTableAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withAuditingState(String auditingState) { + this.inner().withAuditingState(auditingState); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withAuditLogsTableName(String auditLogsTableName) { + this.inner().withAuditLogsTableName(auditLogsTableName); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withEventTypesToAudit(String eventTypesToAudit) { + this.inner().withEventTypesToAudit(eventTypesToAudit); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withFullAuditLogsTableName(String fullAuditLogsTableName) { + this.inner().withFullAuditLogsTableName(fullAuditLogsTableName); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withRetentionDays(String retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withStorageAccountKey(String storageAccountKey) { + this.inner().withStorageAccountKey(storageAccountKey); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withStorageAccountName(String storageAccountName) { + this.inner().withStorageAccountName(storageAccountName); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withStorageAccountResourceGroupName(String storageAccountResourceGroupName) { + this.inner().withStorageAccountResourceGroupName(storageAccountResourceGroupName); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withStorageAccountSecondaryKey(String storageAccountSecondaryKey) { + this.inner().withStorageAccountSecondaryKey(storageAccountSecondaryKey); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public ServerTableAuditingPolicyImpl withStorageTableEndpoint(String storageTableEndpoint) { + this.inner().withStorageTableEndpoint(storageTableEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyInner.java new file mode 100644 index 0000000000000..60406e1738bc9 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyInner.java @@ -0,0 +1,337 @@ +/** + * 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.v2014_04_01.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server table auditing policy. + */ +@JsonFlatten +public class ServerTableAuditingPolicyInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The state of the policy. + */ + @JsonProperty(value = "properties.auditingState") + private String auditingState; + + /** + * The audit logs table name. + */ + @JsonProperty(value = "properties.auditLogsTableName") + private String auditLogsTableName; + + /** + * Comma-separated list of event types to audit. + */ + @JsonProperty(value = "properties.eventTypesToAudit") + private String eventTypesToAudit; + + /** + * The full audit logs table name. + */ + @JsonProperty(value = "properties.fullAuditLogsTableName") + private String fullAuditLogsTableName; + + /** + * The number of days to keep in the audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private String retentionDays; + + /** + * The key of the auditing storage account. + */ + @JsonProperty(value = "properties.storageAccountKey") + private String storageAccountKey; + + /** + * The table storage account name. + */ + @JsonProperty(value = "properties.storageAccountName") + private String storageAccountName; + + /** + * The table storage account resource group name. + */ + @JsonProperty(value = "properties.storageAccountResourceGroupName") + private String storageAccountResourceGroupName; + + /** + * The secondary key of the auditing storage account. + */ + @JsonProperty(value = "properties.storageAccountSecondaryKey") + private String storageAccountSecondaryKey; + + /** + * The table storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * The storage table endpoint. + */ + @JsonProperty(value = "properties.storageTableEndpoint") + private String storageTableEndpoint; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the state of the policy. + * + * @return the auditingState value + */ + public String auditingState() { + return this.auditingState; + } + + /** + * Set the state of the policy. + * + * @param auditingState the auditingState value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withAuditingState(String auditingState) { + this.auditingState = auditingState; + return this; + } + + /** + * Get the audit logs table name. + * + * @return the auditLogsTableName value + */ + public String auditLogsTableName() { + return this.auditLogsTableName; + } + + /** + * Set the audit logs table name. + * + * @param auditLogsTableName the auditLogsTableName value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withAuditLogsTableName(String auditLogsTableName) { + this.auditLogsTableName = auditLogsTableName; + return this; + } + + /** + * Get comma-separated list of event types to audit. + * + * @return the eventTypesToAudit value + */ + public String eventTypesToAudit() { + return this.eventTypesToAudit; + } + + /** + * Set comma-separated list of event types to audit. + * + * @param eventTypesToAudit the eventTypesToAudit value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withEventTypesToAudit(String eventTypesToAudit) { + this.eventTypesToAudit = eventTypesToAudit; + return this; + } + + /** + * Get the full audit logs table name. + * + * @return the fullAuditLogsTableName value + */ + public String fullAuditLogsTableName() { + return this.fullAuditLogsTableName; + } + + /** + * Set the full audit logs table name. + * + * @param fullAuditLogsTableName the fullAuditLogsTableName value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withFullAuditLogsTableName(String fullAuditLogsTableName) { + this.fullAuditLogsTableName = fullAuditLogsTableName; + return this; + } + + /** + * Get the number of days to keep in the audit logs. + * + * @return the retentionDays value + */ + public String retentionDays() { + return this.retentionDays; + } + + /** + * Set the number of days to keep in the audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withRetentionDays(String retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the key of the auditing storage account. + * + * @return the storageAccountKey value + */ + public String storageAccountKey() { + return this.storageAccountKey; + } + + /** + * Set the key of the auditing storage account. + * + * @param storageAccountKey the storageAccountKey value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withStorageAccountKey(String storageAccountKey) { + this.storageAccountKey = storageAccountKey; + return this; + } + + /** + * Get the table storage account name. + * + * @return the storageAccountName value + */ + public String storageAccountName() { + return this.storageAccountName; + } + + /** + * Set the table storage account name. + * + * @param storageAccountName the storageAccountName value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withStorageAccountName(String storageAccountName) { + this.storageAccountName = storageAccountName; + return this; + } + + /** + * Get the table storage account resource group name. + * + * @return the storageAccountResourceGroupName value + */ + public String storageAccountResourceGroupName() { + return this.storageAccountResourceGroupName; + } + + /** + * Set the table storage account resource group name. + * + * @param storageAccountResourceGroupName the storageAccountResourceGroupName value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withStorageAccountResourceGroupName(String storageAccountResourceGroupName) { + this.storageAccountResourceGroupName = storageAccountResourceGroupName; + return this; + } + + /** + * Get the secondary key of the auditing storage account. + * + * @return the storageAccountSecondaryKey value + */ + public String storageAccountSecondaryKey() { + return this.storageAccountSecondaryKey; + } + + /** + * Set the secondary key of the auditing storage account. + * + * @param storageAccountSecondaryKey the storageAccountSecondaryKey value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withStorageAccountSecondaryKey(String storageAccountSecondaryKey) { + this.storageAccountSecondaryKey = storageAccountSecondaryKey; + return this; + } + + /** + * Get the table storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the table storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get the storage table endpoint. + * + * @return the storageTableEndpoint value + */ + public String storageTableEndpoint() { + return this.storageTableEndpoint; + } + + /** + * Set the storage table endpoint. + * + * @param storageTableEndpoint the storageTableEndpoint value to set + * @return the ServerTableAuditingPolicyInner object itself. + */ + public ServerTableAuditingPolicyInner withStorageTableEndpoint(String storageTableEndpoint) { + this.storageTableEndpoint = storageTableEndpoint; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultImpl.java new file mode 100644 index 0000000000000..ea91ae1faeb8d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultImpl.java @@ -0,0 +1,32 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerTableAuditingPolicyListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class ServerTableAuditingPolicyListResultImpl extends WrapperImpl implements ServerTableAuditingPolicyListResult { + private final SqlManager manager; + ServerTableAuditingPolicyListResultImpl(ServerTableAuditingPolicyListResultInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultInner.java new file mode 100644 index 0000000000000..83e5955d9965c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPolicyListResultInner.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.v2014_04_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the response to a list server table auditing policies request. + */ +public class ServerTableAuditingPolicyListResultInner { + /** + * The list of server table auditing policies. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the list of server table auditing policies. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of server table auditing policies. + * + * @param value the value value to set + * @return the ServerTableAuditingPolicyListResultInner object itself. + */ + public ServerTableAuditingPolicyListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageImpl.java new file mode 100644 index 0000000000000..954def2646cbf --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServerUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ServerUsageImpl extends WrapperImpl implements ServerUsage { + private final SqlManager manager; + + ServerUsageImpl(ServerUsageInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime nextResetTime() { + return this.inner().nextResetTime(); + } + + @Override + public String resourceName() { + return this.inner().resourceName(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageInner.java new file mode 100644 index 0000000000000..a59b6b667a9a4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsageInner.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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents server metrics. + */ +public class ServerUsageInner { + /** + * Name of the server usage metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The name of the resource. + */ + @JsonProperty(value = "resourceName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceName; + + /** + * The metric display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The current value of the metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /** + * The current limit of the metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * The units of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The next reset time for the metric (ISO8601 format). + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime nextResetTime; + + /** + * Get name of the server usage metric. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the name of the resource. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the metric display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the current value of the metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the current limit of the metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get the units of the metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the next reset time for the metric (ISO8601 format). + * + * @return the nextResetTime value + */ + public DateTime nextResetTime() { + return this.nextResetTime; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesImpl.java new file mode 100644 index 0000000000000..8ab329830f23b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServerUsages; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServerUsage; + +class ServerUsagesImpl extends WrapperImpl implements ServerUsages { + private final SqlManager manager; + + ServerUsagesImpl(SqlManager manager) { + super(manager.inner().serverUsages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServerUsageImpl wrapModel(ServerUsageInner inner) { + return new ServerUsageImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerUsagesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServerUsage call(ServerUsageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesInner.java new file mode 100644 index 0000000000000..882edaf6b540d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesInner.java @@ -0,0 +1,152 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerUsages. + */ +public class ServerUsagesInner { + /** The Retrofit service to perform REST calls. */ + private ServerUsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerUsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerUsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerUsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerUsages to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerUsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServerUsages listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages") + 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); + + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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 List<ServerUsageInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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 List<ServerUsageInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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 List<ServerUsageInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java index fb29786e42b3b..91a707fe05c27 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java @@ -4,27 +4,126 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * abc + * def */ package com.microsoft.azure.management.sql.v2014_04_01.implementation; -import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; import com.microsoft.azure.management.sql.v2014_04_01.Servers; -import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.Server; 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; import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityResponse; -class ServersImpl extends WrapperImpl implements Servers { - private final SqlManager manager; +class ServersImpl extends GroupableResourcesCoreImpl implements Servers { + protected ServersImpl(SqlManager manager) { + super(manager.inner().servers(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ServersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ServersInner 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) { + ServersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ServersInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public Server call(ServerInner inner) { + return wrapModel(inner); + } + }); + } - ServersImpl(SqlManager manager) { - super(manager.inner().servers()); - this.manager = manager; + @Override + public PagedList list() { + ServersInner client = this.inner(); + return this.wrapList(client.list()); } - public SqlManager manager() { - return this.manager; + @Override + public Observable listAsync() { + ServersInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public Server call(ServerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ServerImpl define(String name) { + return wrapModel(name); } @Override @@ -39,4 +138,14 @@ public CheckNameAvailabilityResponse call(CheckNameAvailabilityResponseInner inn }); } + @Override + protected ServerImpl wrapModel(ServerInner inner) { + return new ServerImpl(inner.name(), inner, manager()); + } + + @Override + protected ServerImpl wrapModel(String name) { + return new ServerImpl(name, new ServerInner(), this.manager()); + } + } diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java index ae53681ce9724..5143f40c5a3f1 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java @@ -8,20 +8,32 @@ package com.microsoft.azure.management.sql.v2014_04_01.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.CloudException; import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityRequest; +import com.microsoft.azure.management.sql.v2014_04_01.ServerUpdate; +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.Response; import rx.functions.Func1; @@ -31,7 +43,7 @@ * An instance of this class provides access to all the operations defined * in Servers. */ -public class ServersInner { +public class ServersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private ServersService service; /** The service client containing this operation class. */ @@ -57,6 +69,30 @@ interface ServersService { @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability") Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityRequest parameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Servers list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers") + 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.v2014_04_01.Servers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerInner 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.v2014_04_01.Servers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpdate 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.v2014_04_01.Servers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2014_04_01.Servers getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> getByResourceGroup(@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.v2014_04_01.Servers listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -140,4 +176,534 @@ private ServiceResponse checkNameAvailabilit .build(response); } + /** + * Returns a list of servers. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Returns a list of servers. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Returns a list of servers. + * + * @return the observable to the List<ServerInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Returns a list of servers. + * + * @return the observable to the List<ServerInner> object + */ + public Observable>> listWithServiceResponseAsync() { + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Creates or updates a new 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 parameters The required parameters for creating or updating a 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 ServerInner object if successful. + */ + public ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a new 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 parameters The required parameters for creating or updating a 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 createOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a new 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 parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a new 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 parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerInner 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); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, 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); + } + + /** + * Updates an existing 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 parameters The required parameters for updating a 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 ServerInner object if successful. + */ + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing 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 parameters The required parameters for updating a 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 updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates an existing 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 parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing 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 parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdate 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); + return service.update(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 SQL 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 + */ + public void delete(String resourceGroupName, String serverName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Deletes a SQL 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 deleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes a SQL 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 {@link ServiceResponse} object if successful. + */ + 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 a SQL 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 {@link ServiceResponse} object if successful. + */ + 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."); + } + return service.delete(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 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets 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 ServerInner object if successful. + */ + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets 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 getByResourceGroupAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets 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 ServerInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 ServerInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(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."); + } + return service.getByResourceGroup(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 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); + } + + /** + * Returns a list of servers 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. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Returns a list of servers 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. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Returns a list of servers 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. + * @return the observable to the List<ServerInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Returns a list of servers 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. + * @return the observable to the List<ServerInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + } diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveImpl.java new file mode 100644 index 0000000000000..f2657372dd759 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveImpl.java @@ -0,0 +1,82 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjective; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class ServiceObjectiveImpl extends IndexableRefreshableWrapperImpl implements ServiceObjective { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String serviceObjectiveName; + + ServiceObjectiveImpl(ServiceObjectiveInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.serviceObjectiveName = IdParsingUtils.getValueFromIdByName(inner.id(), "serviceObjectives"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ServiceObjectivesInner client = this.manager().inner().serviceObjectives(); + return client.getAsync(this.resourceGroupName, this.serverName, this.serviceObjectiveName); + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public boolean isDefault() { + return this.inner().isDefault(); + } + + @Override + public boolean isSystem() { + return this.inner().isSystem(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceObjectiveName() { + return this.inner().serviceObjectiveName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveInner.java new file mode 100644 index 0000000000000..572b9e2d9ad74 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectiveInner.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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database service objective. + */ +@JsonFlatten +public class ServiceObjectiveInner extends ProxyResource { + /** + * The name for the service objective. + */ + @JsonProperty(value = "properties.serviceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceObjectiveName; + + /** + * Gets whether the service level objective is the default service + * objective. + */ + @JsonProperty(value = "properties.isDefault", access = JsonProperty.Access.WRITE_ONLY) + private boolean isDefault; + + /** + * Gets whether the service level objective is a system service objective. + */ + @JsonProperty(value = "properties.isSystem", access = JsonProperty.Access.WRITE_ONLY) + private boolean isSystem; + + /** + * The description for the service level objective. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Gets whether the service level objective is enabled. + */ + @JsonProperty(value = "properties.enabled", access = JsonProperty.Access.WRITE_ONLY) + private boolean enabled; + + /** + * Get the name for the service objective. + * + * @return the serviceObjectiveName value + */ + public String serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Get gets whether the service level objective is the default service objective. + * + * @return the isDefault value + */ + public boolean isDefault() { + return this.isDefault; + } + + /** + * Get gets whether the service level objective is a system service objective. + * + * @return the isSystem value + */ + public boolean isSystem() { + return this.isSystem; + } + + /** + * Get the description for the service level objective. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get gets whether the service level objective is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesImpl.java new file mode 100644 index 0000000000000..8f1bc7f8204d8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjectives; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjective; + +class ServiceObjectivesImpl extends WrapperImpl implements ServiceObjectives { + private final SqlManager manager; + + ServiceObjectivesImpl(SqlManager manager) { + super(manager.inner().serviceObjectives()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServiceObjectiveImpl wrapModel(ServiceObjectiveInner inner) { + return new ServiceObjectiveImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServiceObjectivesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServiceObjective call(ServiceObjectiveInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String serviceObjectiveName) { + ServiceObjectivesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, serviceObjectiveName) + .map(new Func1() { + @Override + public ServiceObjective call(ServiceObjectiveInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesInner.java new file mode 100644 index 0000000000000..681d9b3931e24 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceObjectivesInner.java @@ -0,0 +1,249 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServiceObjectives. + */ +public class ServiceObjectivesInner { + /** The Retrofit service to perform REST calls. */ + private ServiceObjectivesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceObjectivesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServiceObjectivesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServiceObjectivesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServiceObjectives to be + * used by Retrofit to perform actually REST calls. + */ + interface ServiceObjectivesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServiceObjectives get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("serviceObjectiveName") String serviceObjectiveName, @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.v2014_04_01.ServiceObjectives listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives") + 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); + + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @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 ServiceObjectiveInner object if successful. + */ + public ServiceObjectiveInner get(String resourceGroupName, String serverName, String serviceObjectiveName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, serviceObjectiveName).toBlocking().single().body(); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @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 serviceObjectiveName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, serviceObjectiveName), serviceCallback); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceObjectiveInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String serviceObjectiveName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, serviceObjectiveName).map(new Func1, ServiceObjectiveInner>() { + @Override + public ServiceObjectiveInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceObjectiveInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String serviceObjectiveName) { + 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 (serviceObjectiveName == null) { + throw new IllegalArgumentException("Parameter serviceObjectiveName 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(this.client.subscriptionId(), resourceGroupName, serverName, serviceObjectiveName, 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); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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 List<ServiceObjectiveInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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 List<ServiceObjectiveInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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 List<ServiceObjectiveInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java index ddb7d43009f90..6ef140b831176 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java @@ -28,6 +28,18 @@ public AzureClient getAzureClient() { return this.azureClient; } + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + /** The subscription ID that identifies an Azure subscription. */ private String subscriptionId; @@ -51,18 +63,6 @@ public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { return this; } - /** The API version to use for the request. */ - private String apiVersion; - - /** - * Gets The API version to use for the request. - * - * @return the apiVersion value. - */ - public String apiVersion() { - return this.apiVersion; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -132,6 +132,97 @@ public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClien return this; } + /** + * The ServerAdvisorsInner object to access its operations. + */ + private ServerAdvisorsInner serverAdvisors; + + /** + * Gets the ServerAdvisorsInner object to access its operations. + * @return the ServerAdvisorsInner object. + */ + public ServerAdvisorsInner serverAdvisors() { + return this.serverAdvisors; + } + + /** + * The DatabaseAdvisorsInner object to access its operations. + */ + private DatabaseAdvisorsInner databaseAdvisors; + + /** + * Gets the DatabaseAdvisorsInner object to access its operations. + * @return the DatabaseAdvisorsInner object. + */ + public DatabaseAdvisorsInner databaseAdvisors() { + return this.databaseAdvisors; + } + + /** + * The BackupLongTermRetentionPoliciesInner object to access its operations. + */ + private BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies; + + /** + * Gets the BackupLongTermRetentionPoliciesInner object to access its operations. + * @return the BackupLongTermRetentionPoliciesInner object. + */ + public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { + return this.backupLongTermRetentionPolicies; + } + + /** + * The BackupLongTermRetentionVaultsInner object to access its operations. + */ + private BackupLongTermRetentionVaultsInner backupLongTermRetentionVaults; + + /** + * Gets the BackupLongTermRetentionVaultsInner object to access its operations. + * @return the BackupLongTermRetentionVaultsInner object. + */ + public BackupLongTermRetentionVaultsInner backupLongTermRetentionVaults() { + return this.backupLongTermRetentionVaults; + } + + /** + * The RecoverableDatabasesInner object to access its operations. + */ + private RecoverableDatabasesInner recoverableDatabases; + + /** + * Gets the RecoverableDatabasesInner object to access its operations. + * @return the RecoverableDatabasesInner object. + */ + public RecoverableDatabasesInner recoverableDatabases() { + return this.recoverableDatabases; + } + + /** + * The RestorableDroppedDatabasesInner object to access its operations. + */ + private RestorableDroppedDatabasesInner restorableDroppedDatabases; + + /** + * Gets the RestorableDroppedDatabasesInner object to access its operations. + * @return the RestorableDroppedDatabasesInner object. + */ + public RestorableDroppedDatabasesInner restorableDroppedDatabases() { + return this.restorableDroppedDatabases; + } + + /** + * The CapabilitiesInner object to access its operations. + */ + private CapabilitiesInner capabilities; + + /** + * Gets the CapabilitiesInner object to access its operations. + * @return the CapabilitiesInner object. + */ + public CapabilitiesInner capabilities() { + return this.capabilities; + } + /** * The ServersInner object to access its operations. */ @@ -145,6 +236,19 @@ public ServersInner servers() { return this.servers; } + /** + * The ServerConnectionPoliciesInner object to access its operations. + */ + private ServerConnectionPoliciesInner serverConnectionPolicies; + + /** + * Gets the ServerConnectionPoliciesInner object to access its operations. + * @return the ServerConnectionPoliciesInner object. + */ + public ServerConnectionPoliciesInner serverConnectionPolicies() { + return this.serverConnectionPolicies; + } + /** * The DatabasesInner object to access its operations. */ @@ -158,6 +262,84 @@ public DatabasesInner databases() { return this.databases; } + /** + * The DatabaseThreatDetectionPoliciesInner object to access its operations. + */ + private DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies; + + /** + * Gets the DatabaseThreatDetectionPoliciesInner object to access its operations. + * @return the DatabaseThreatDetectionPoliciesInner object. + */ + public DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies() { + return this.databaseThreatDetectionPolicies; + } + + /** + * The DataMaskingPoliciesInner object to access its operations. + */ + private DataMaskingPoliciesInner dataMaskingPolicies; + + /** + * Gets the DataMaskingPoliciesInner object to access its operations. + * @return the DataMaskingPoliciesInner object. + */ + public DataMaskingPoliciesInner dataMaskingPolicies() { + return this.dataMaskingPolicies; + } + + /** + * The DataMaskingRulesInner object to access its operations. + */ + private DataMaskingRulesInner dataMaskingRules; + + /** + * Gets the DataMaskingRulesInner object to access its operations. + * @return the DataMaskingRulesInner object. + */ + public DataMaskingRulesInner dataMaskingRules() { + return this.dataMaskingRules; + } + + /** + * The TransparentDataEncryptionConfigurationsInner object to access its operations. + */ + private TransparentDataEncryptionConfigurationsInner transparentDataEncryptionConfigurations; + + /** + * Gets the TransparentDataEncryptionConfigurationsInner object to access its operations. + * @return the TransparentDataEncryptionConfigurationsInner object. + */ + public TransparentDataEncryptionConfigurationsInner transparentDataEncryptionConfigurations() { + return this.transparentDataEncryptionConfigurations; + } + + /** + * The ExtensionsInner object to access its operations. + */ + private ExtensionsInner extensions; + + /** + * Gets the ExtensionsInner object to access its operations. + * @return the ExtensionsInner object. + */ + public ExtensionsInner extensions() { + return this.extensions; + } + + /** + * The DisasterRecoveryConfigurationsInner object to access its operations. + */ + private DisasterRecoveryConfigurationsInner disasterRecoveryConfigurations; + + /** + * Gets the DisasterRecoveryConfigurationsInner object to access its operations. + * @return the DisasterRecoveryConfigurationsInner object. + */ + public DisasterRecoveryConfigurationsInner disasterRecoveryConfigurations() { + return this.disasterRecoveryConfigurations; + } + /** * The ElasticPoolsInner object to access its operations. */ @@ -184,6 +366,71 @@ public FirewallRulesInner firewallRules() { return this.firewallRules; } + /** + * The GeoBackupPoliciesInner object to access its operations. + */ + private GeoBackupPoliciesInner geoBackupPolicies; + + /** + * Gets the GeoBackupPoliciesInner object to access its operations. + * @return the GeoBackupPoliciesInner object. + */ + public GeoBackupPoliciesInner geoBackupPolicies() { + return this.geoBackupPolicies; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The QueriesInner object to access its operations. + */ + private QueriesInner queries; + + /** + * Gets the QueriesInner object to access its operations. + * @return the QueriesInner object. + */ + public QueriesInner queries() { + return this.queries; + } + + /** + * The QueryStatisticsInner object to access its operations. + */ + private QueryStatisticsInner queryStatistics; + + /** + * Gets the QueryStatisticsInner object to access its operations. + * @return the QueryStatisticsInner object. + */ + public QueryStatisticsInner queryStatistics() { + return this.queryStatistics; + } + + /** + * The QueryTextsInner object to access its operations. + */ + private QueryTextsInner queryTexts; + + /** + * Gets the QueryTextsInner object to access its operations. + * @return the QueryTextsInner object. + */ + public QueryTextsInner queryTexts() { + return this.queryTexts; + } + /** * The RecommendedElasticPoolsInner object to access its operations. */ @@ -210,6 +457,58 @@ public ReplicationLinksInner replicationLinks() { return this.replicationLinks; } + /** + * The RestorePointsInner object to access its operations. + */ + private RestorePointsInner restorePoints; + + /** + * Gets the RestorePointsInner object to access its operations. + * @return the RestorePointsInner object. + */ + public RestorePointsInner restorePoints() { + return this.restorePoints; + } + + /** + * 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 ServerCommunicationLinksInner object to access its operations. + */ + private ServerCommunicationLinksInner serverCommunicationLinks; + + /** + * Gets the ServerCommunicationLinksInner object to access its operations. + * @return the ServerCommunicationLinksInner object. + */ + public ServerCommunicationLinksInner serverCommunicationLinks() { + return this.serverCommunicationLinks; + } + + /** + * The ServiceObjectivesInner object to access its operations. + */ + private ServiceObjectivesInner serviceObjectives; + + /** + * Gets the ServiceObjectivesInner object to access its operations. + * @return the ServiceObjectivesInner object. + */ + public ServiceObjectivesInner serviceObjectives() { + return this.serviceObjectives; + } + /** * The ElasticPoolActivitiesInner object to access its operations. */ @@ -276,16 +575,68 @@ public TransparentDataEncryptionActivitiesInner transparentDataEncryptionActivit } /** - * The DatabaseThreatDetectionPoliciesInner object to access its operations. + * The ServerTableAuditingPoliciesInner object to access its operations. */ - private DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies; + private ServerTableAuditingPoliciesInner serverTableAuditingPolicies; /** - * Gets the DatabaseThreatDetectionPoliciesInner object to access its operations. - * @return the DatabaseThreatDetectionPoliciesInner object. + * Gets the ServerTableAuditingPoliciesInner object to access its operations. + * @return the ServerTableAuditingPoliciesInner object. */ - public DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies() { - return this.databaseThreatDetectionPolicies; + public ServerTableAuditingPoliciesInner serverTableAuditingPolicies() { + return this.serverTableAuditingPolicies; + } + + /** + * The DatabaseTableAuditingPoliciesInner object to access its operations. + */ + private DatabaseTableAuditingPoliciesInner databaseTableAuditingPolicies; + + /** + * Gets the DatabaseTableAuditingPoliciesInner object to access its operations. + * @return the DatabaseTableAuditingPoliciesInner object. + */ + public DatabaseTableAuditingPoliciesInner databaseTableAuditingPolicies() { + return this.databaseTableAuditingPolicies; + } + + /** + * The DatabaseConnectionPoliciesInner object to access its operations. + */ + private DatabaseConnectionPoliciesInner databaseConnectionPolicies; + + /** + * Gets the DatabaseConnectionPoliciesInner object to access its operations. + * @return the DatabaseConnectionPoliciesInner object. + */ + public DatabaseConnectionPoliciesInner databaseConnectionPolicies() { + return this.databaseConnectionPolicies; + } + + /** + * The ServerUsagesInner object to access its operations. + */ + private ServerUsagesInner serverUsages; + + /** + * Gets the ServerUsagesInner object to access its operations. + * @return the ServerUsagesInner object. + */ + public ServerUsagesInner serverUsages() { + return this.serverUsages; + } + + /** + * The DatabaseUsagesInner object to access its operations. + */ + private DatabaseUsagesInner databaseUsages; + + /** + * Gets the DatabaseUsagesInner object to access its operations. + * @return the DatabaseUsagesInner object. + */ + public DatabaseUsagesInner databaseUsages() { + return this.databaseUsages; } /** @@ -323,18 +674,45 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; + this.serverAdvisors = new ServerAdvisorsInner(restClient().retrofit(), this); + this.databaseAdvisors = new DatabaseAdvisorsInner(restClient().retrofit(), this); + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); + this.backupLongTermRetentionVaults = new BackupLongTermRetentionVaultsInner(restClient().retrofit(), this); + this.recoverableDatabases = new RecoverableDatabasesInner(restClient().retrofit(), this); + this.restorableDroppedDatabases = new RestorableDroppedDatabasesInner(restClient().retrofit(), this); + this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); this.servers = new ServersInner(restClient().retrofit(), this); + this.serverConnectionPolicies = new ServerConnectionPoliciesInner(restClient().retrofit(), this); this.databases = new DatabasesInner(restClient().retrofit(), this); + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesInner(restClient().retrofit(), this); + this.dataMaskingPolicies = new DataMaskingPoliciesInner(restClient().retrofit(), this); + this.dataMaskingRules = new DataMaskingRulesInner(restClient().retrofit(), this); + this.transparentDataEncryptionConfigurations = new TransparentDataEncryptionConfigurationsInner(restClient().retrofit(), this); + this.extensions = new ExtensionsInner(restClient().retrofit(), this); + this.disasterRecoveryConfigurations = new DisasterRecoveryConfigurationsInner(restClient().retrofit(), this); this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); this.firewallRules = new FirewallRulesInner(restClient().retrofit(), this); + this.geoBackupPolicies = new GeoBackupPoliciesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.queries = new QueriesInner(restClient().retrofit(), this); + this.queryStatistics = new QueryStatisticsInner(restClient().retrofit(), this); + this.queryTexts = new QueryTextsInner(restClient().retrofit(), this); this.recommendedElasticPools = new RecommendedElasticPoolsInner(restClient().retrofit(), this); this.replicationLinks = new ReplicationLinksInner(restClient().retrofit(), this); + this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); + this.serverAzureADAdministrators = new ServerAzureADAdministratorsInner(restClient().retrofit(), this); + this.serverCommunicationLinks = new ServerCommunicationLinksInner(restClient().retrofit(), this); + this.serviceObjectives = new ServiceObjectivesInner(restClient().retrofit(), this); this.elasticPoolActivities = new ElasticPoolActivitiesInner(restClient().retrofit(), this); this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesInner(restClient().retrofit(), this); this.serviceTierAdvisors = new ServiceTierAdvisorsInner(restClient().retrofit(), this); this.transparentDataEncryptions = new TransparentDataEncryptionsInner(restClient().retrofit(), this); this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesInner(restClient().retrofit(), this); - this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesInner(restClient().retrofit(), this); + this.serverTableAuditingPolicies = new ServerTableAuditingPoliciesInner(restClient().retrofit(), this); + this.databaseTableAuditingPolicies = new DatabaseTableAuditingPoliciesInner(restClient().retrofit(), this); + this.databaseConnectionPolicies = new DatabaseConnectionPoliciesInner(restClient().retrofit(), this); + this.serverUsages = new ServerUsagesInner(restClient().retrofit(), this); + this.databaseUsages = new DatabaseUsagesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java index 48bcb3d5c4a75..61b8cfd94e451 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java @@ -16,18 +16,45 @@ import com.microsoft.azure.arm.resources.AzureConfigurable; import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2014_04_01.ServerAdvisors; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseAdvisors; +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.BackupLongTermRetentionVaults; +import com.microsoft.azure.management.sql.v2014_04_01.RecoverableDatabases; +import com.microsoft.azure.management.sql.v2014_04_01.RestorableDroppedDatabases; +import com.microsoft.azure.management.sql.v2014_04_01.Capabilities; import com.microsoft.azure.management.sql.v2014_04_01.Servers; +import com.microsoft.azure.management.sql.v2014_04_01.ServerConnectionPolicies; import com.microsoft.azure.management.sql.v2014_04_01.Databases; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.DataMaskingRules; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionConfigurations; +import com.microsoft.azure.management.sql.v2014_04_01.Extensions; +import com.microsoft.azure.management.sql.v2014_04_01.DisasterRecoveryConfigurations; import com.microsoft.azure.management.sql.v2014_04_01.ElasticPools; import com.microsoft.azure.management.sql.v2014_04_01.FirewallRules; +import com.microsoft.azure.management.sql.v2014_04_01.GeoBackupPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.Operations; +import com.microsoft.azure.management.sql.v2014_04_01.Queries; +import com.microsoft.azure.management.sql.v2014_04_01.QueryStatistics; +import com.microsoft.azure.management.sql.v2014_04_01.QueryTexts; import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools; import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLinks; +import com.microsoft.azure.management.sql.v2014_04_01.RestorePoints; +import com.microsoft.azure.management.sql.v2014_04_01.ServerAzureADAdministrators; +import com.microsoft.azure.management.sql.v2014_04_01.ServerCommunicationLinks; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjectives; import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivities; import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivities; import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisors; import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions; import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivities; -import com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.ServerTableAuditingPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseTableAuditingPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseConnectionPolicies; +import com.microsoft.azure.management.sql.v2014_04_01.ServerUsages; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUsages; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -35,18 +62,45 @@ * Entry point to Azure Sql resource management. */ public final class SqlManager extends ManagerCore { + private ServerAdvisors serverAdvisors; + private DatabaseAdvisors databaseAdvisors; + private BackupLongTermRetentionPolicies backupLongTermRetentionPolicies; + private BackupLongTermRetentionVaults backupLongTermRetentionVaults; + private RecoverableDatabases recoverableDatabases; + private RestorableDroppedDatabases restorableDroppedDatabases; + private Capabilities capabilities; private Servers servers; + private ServerConnectionPolicies serverConnectionPolicies; private Databases databases; + private DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies; + private DataMaskingPolicies dataMaskingPolicies; + private DataMaskingRules dataMaskingRules; + private TransparentDataEncryptionConfigurations transparentDataEncryptionConfigurations; + private Extensions extensions; + private DisasterRecoveryConfigurations disasterRecoveryConfigurations; private ElasticPools elasticPools; private FirewallRules firewallRules; + private GeoBackupPolicies geoBackupPolicies; + private Operations operations; + private Queries queries; + private QueryStatistics queryStatistics; + private QueryTexts queryTexts; private RecommendedElasticPools recommendedElasticPools; private ReplicationLinks replicationLinks; + private RestorePoints restorePoints; + private ServerAzureADAdministrators serverAzureADAdministrators; + private ServerCommunicationLinks serverCommunicationLinks; + private ServiceObjectives serviceObjectives; private ElasticPoolActivities elasticPoolActivities; private ElasticPoolDatabaseActivities elasticPoolDatabaseActivities; private ServiceTierAdvisors serviceTierAdvisors; private TransparentDataEncryptions transparentDataEncryptions; private TransparentDataEncryptionActivities transparentDataEncryptionActivities; - private DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies; + private ServerTableAuditingPolicies serverTableAuditingPolicies; + private DatabaseTableAuditingPolicies databaseTableAuditingPolicies; + private DatabaseConnectionPolicies databaseConnectionPolicies; + private ServerUsages serverUsages; + private DatabaseUsages databaseUsages; /** * Get a Configurable instance that can be used to create SqlManager with optional configuration. * @@ -94,6 +148,76 @@ public interface Configurable extends AzureConfigurable { SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); } + /** + * @return Entry point to manage ServerAdvisors. + */ + public ServerAdvisors serverAdvisors() { + if (this.serverAdvisors == null) { + this.serverAdvisors = new ServerAdvisorsImpl(this); + } + return this.serverAdvisors; + } + + /** + * @return Entry point to manage DatabaseAdvisors. + */ + public DatabaseAdvisors databaseAdvisors() { + if (this.databaseAdvisors == null) { + this.databaseAdvisors = new DatabaseAdvisorsImpl(this); + } + return this.databaseAdvisors; + } + + /** + * @return Entry point to manage BackupLongTermRetentionPolicies. + */ + public BackupLongTermRetentionPolicies backupLongTermRetentionPolicies() { + if (this.backupLongTermRetentionPolicies == null) { + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesImpl(this); + } + return this.backupLongTermRetentionPolicies; + } + + /** + * @return Entry point to manage BackupLongTermRetentionVaults. + */ + public BackupLongTermRetentionVaults backupLongTermRetentionVaults() { + if (this.backupLongTermRetentionVaults == null) { + this.backupLongTermRetentionVaults = new BackupLongTermRetentionVaultsImpl(this); + } + return this.backupLongTermRetentionVaults; + } + + /** + * @return Entry point to manage RecoverableDatabases. + */ + public RecoverableDatabases recoverableDatabases() { + if (this.recoverableDatabases == null) { + this.recoverableDatabases = new RecoverableDatabasesImpl(this); + } + return this.recoverableDatabases; + } + + /** + * @return Entry point to manage RestorableDroppedDatabases. + */ + public RestorableDroppedDatabases restorableDroppedDatabases() { + if (this.restorableDroppedDatabases == null) { + this.restorableDroppedDatabases = new RestorableDroppedDatabasesImpl(this); + } + return this.restorableDroppedDatabases; + } + + /** + * @return Entry point to manage Capabilities. + */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(this); + } + return this.capabilities; + } + /** * @return Entry point to manage Servers. */ @@ -104,6 +228,16 @@ public Servers servers() { return this.servers; } + /** + * @return Entry point to manage ServerConnectionPolicies. + */ + public ServerConnectionPolicies serverConnectionPolicies() { + if (this.serverConnectionPolicies == null) { + this.serverConnectionPolicies = new ServerConnectionPoliciesImpl(this); + } + return this.serverConnectionPolicies; + } + /** * @return Entry point to manage Databases. */ @@ -114,6 +248,66 @@ public Databases databases() { return this.databases; } + /** + * @return Entry point to manage DatabaseThreatDetectionPolicies. + */ + public DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies() { + if (this.databaseThreatDetectionPolicies == null) { + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesImpl(this); + } + return this.databaseThreatDetectionPolicies; + } + + /** + * @return Entry point to manage DataMaskingPolicies. + */ + public DataMaskingPolicies dataMaskingPolicies() { + if (this.dataMaskingPolicies == null) { + this.dataMaskingPolicies = new DataMaskingPoliciesImpl(this); + } + return this.dataMaskingPolicies; + } + + /** + * @return Entry point to manage DataMaskingRules. + */ + public DataMaskingRules dataMaskingRules() { + if (this.dataMaskingRules == null) { + this.dataMaskingRules = new DataMaskingRulesImpl(this); + } + return this.dataMaskingRules; + } + + /** + * @return Entry point to manage TransparentDataEncryptionConfigurations. + */ + public TransparentDataEncryptionConfigurations transparentDataEncryptionConfigurations() { + if (this.transparentDataEncryptionConfigurations == null) { + this.transparentDataEncryptionConfigurations = new TransparentDataEncryptionConfigurationsImpl(this); + } + return this.transparentDataEncryptionConfigurations; + } + + /** + * @return Entry point to manage Extensions. + */ + public Extensions extensions() { + if (this.extensions == null) { + this.extensions = new ExtensionsImpl(this); + } + return this.extensions; + } + + /** + * @return Entry point to manage DisasterRecoveryConfigurations. + */ + public DisasterRecoveryConfigurations disasterRecoveryConfigurations() { + if (this.disasterRecoveryConfigurations == null) { + this.disasterRecoveryConfigurations = new DisasterRecoveryConfigurationsImpl(this); + } + return this.disasterRecoveryConfigurations; + } + /** * @return Entry point to manage ElasticPools. */ @@ -134,6 +328,56 @@ public FirewallRules firewallRules() { return this.firewallRules; } + /** + * @return Entry point to manage GeoBackupPolicies. + */ + public GeoBackupPolicies geoBackupPolicies() { + if (this.geoBackupPolicies == null) { + this.geoBackupPolicies = new GeoBackupPoliciesImpl(this); + } + return this.geoBackupPolicies; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Queries. + */ + public Queries queries() { + if (this.queries == null) { + this.queries = new QueriesImpl(this); + } + return this.queries; + } + + /** + * @return Entry point to manage QueryStatistics. + */ + public QueryStatistics queryStatistics() { + if (this.queryStatistics == null) { + this.queryStatistics = new QueryStatisticsImpl(this); + } + return this.queryStatistics; + } + + /** + * @return Entry point to manage QueryTexts. + */ + public QueryTexts queryTexts() { + if (this.queryTexts == null) { + this.queryTexts = new QueryTextsImpl(this); + } + return this.queryTexts; + } + /** * @return Entry point to manage RecommendedElasticPools. */ @@ -154,6 +398,46 @@ public ReplicationLinks replicationLinks() { return this.replicationLinks; } + /** + * @return Entry point to manage RestorePoints. + */ + public RestorePoints restorePoints() { + if (this.restorePoints == null) { + this.restorePoints = new RestorePointsImpl(this); + } + return this.restorePoints; + } + + /** + * @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 ServerCommunicationLinks. + */ + public ServerCommunicationLinks serverCommunicationLinks() { + if (this.serverCommunicationLinks == null) { + this.serverCommunicationLinks = new ServerCommunicationLinksImpl(this); + } + return this.serverCommunicationLinks; + } + + /** + * @return Entry point to manage ServiceObjectives. + */ + public ServiceObjectives serviceObjectives() { + if (this.serviceObjectives == null) { + this.serviceObjectives = new ServiceObjectivesImpl(this); + } + return this.serviceObjectives; + } + /** * @return Entry point to manage ElasticPoolActivities. */ @@ -205,13 +489,53 @@ public TransparentDataEncryptionActivities transparentDataEncryptionActivities() } /** - * @return Entry point to manage DatabaseThreatDetectionPolicies. + * @return Entry point to manage ServerTableAuditingPolicies. */ - public DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies() { - if (this.databaseThreatDetectionPolicies == null) { - this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesImpl(this); + public ServerTableAuditingPolicies serverTableAuditingPolicies() { + if (this.serverTableAuditingPolicies == null) { + this.serverTableAuditingPolicies = new ServerTableAuditingPoliciesImpl(this); } - return this.databaseThreatDetectionPolicies; + return this.serverTableAuditingPolicies; + } + + /** + * @return Entry point to manage DatabaseTableAuditingPolicies. + */ + public DatabaseTableAuditingPolicies databaseTableAuditingPolicies() { + if (this.databaseTableAuditingPolicies == null) { + this.databaseTableAuditingPolicies = new DatabaseTableAuditingPoliciesImpl(this); + } + return this.databaseTableAuditingPolicies; + } + + /** + * @return Entry point to manage DatabaseConnectionPolicies. + */ + public DatabaseConnectionPolicies databaseConnectionPolicies() { + if (this.databaseConnectionPolicies == null) { + this.databaseConnectionPolicies = new DatabaseConnectionPoliciesImpl(this); + } + return this.databaseConnectionPolicies; + } + + /** + * @return Entry point to manage ServerUsages. + */ + public ServerUsages serverUsages() { + if (this.serverUsages == null) { + this.serverUsages = new ServerUsagesImpl(this); + } + return this.serverUsages; + } + + /** + * @return Entry point to manage DatabaseUsages. + */ + public DatabaseUsages databaseUsages() { + if (this.databaseUsages == null) { + this.databaseUsages = new DatabaseUsagesImpl(this); + } + return this.databaseUsages; } /** diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesImpl.java new file mode 100644 index 0000000000000..cea47154e8c00 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesImpl.java @@ -0,0 +1,83 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TopQueries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.QueryAggregationFunction; +import com.microsoft.azure.management.sql.v2014_04_01.QueryExecutionType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.QueryObservedMetricType; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v2014_04_01.QueryStatistic; +import java.util.List; + +class TopQueriesImpl extends WrapperImpl implements TopQueries { + private final SqlManager manager; + + TopQueriesImpl(TopQueriesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public QueryAggregationFunction aggregationFunction() { + return this.inner().aggregationFunction(); + } + + @Override + public QueryExecutionType executionType() { + return this.inner().executionType(); + } + + @Override + public String intervalType() { + return this.inner().intervalType(); + } + + @Override + public Double numberOfTopQueries() { + return this.inner().numberOfTopQueries(); + } + + @Override + public DateTime observationEndTime() { + return this.inner().observationEndTime(); + } + + @Override + public DateTime observationStartTime() { + return this.inner().observationStartTime(); + } + + @Override + public QueryObservedMetricType observedMetric() { + return this.inner().observedMetric(); + } + + @Override + public List queries() { + List lst = new ArrayList(); + if (this.inner().queries() != null) { + for (QueryStatisticInner inner : this.inner().queries()) { + lst.add( new QueryStatisticImpl(inner, manager())); + } + } + return lst; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesInner.java new file mode 100644 index 0000000000000..279f1368001fa --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TopQueriesInner.java @@ -0,0 +1,146 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.QueryAggregationFunction; +import com.microsoft.azure.management.sql.v2014_04_01.QueryExecutionType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.QueryObservedMetricType; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database query. + */ +public class TopQueriesInner { + /** + * The function that is used to aggregate each query's metrics. Possible + * values include: 'min', 'max', 'avg', 'sum'. + */ + @JsonProperty(value = "aggregationFunction", access = JsonProperty.Access.WRITE_ONLY) + private QueryAggregationFunction aggregationFunction; + + /** + * The execution type that is used to filter the query instances that are + * returned. Possible values include: 'any', 'regular', 'irregular', + * 'aborted', 'exception'. + */ + @JsonProperty(value = "executionType", access = JsonProperty.Access.WRITE_ONLY) + private QueryExecutionType executionType; + + /** + * The duration of the interval (ISO8601 duration format). + */ + @JsonProperty(value = "intervalType", access = JsonProperty.Access.WRITE_ONLY) + private String intervalType; + + /** + * The number of requested queries. + */ + @JsonProperty(value = "numberOfTopQueries", access = JsonProperty.Access.WRITE_ONLY) + private Double numberOfTopQueries; + + /** + * The start time for queries that are returned (ISO8601 format). + */ + @JsonProperty(value = "observationStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationStartTime; + + /** + * The end time for queries that are returned (ISO8601 format). + */ + @JsonProperty(value = "observationEndTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationEndTime; + + /** + * The type of metric to use for ordering the top metrics. Possible values + * include: 'cpu', 'io', 'logio', 'duration', 'executionCount'. + */ + @JsonProperty(value = "observedMetric", access = JsonProperty.Access.WRITE_ONLY) + private QueryObservedMetricType observedMetric; + + /** + * The list of queries. + */ + @JsonProperty(value = "queries", access = JsonProperty.Access.WRITE_ONLY) + private List queries; + + /** + * Get the function that is used to aggregate each query's metrics. Possible values include: 'min', 'max', 'avg', 'sum'. + * + * @return the aggregationFunction value + */ + public QueryAggregationFunction aggregationFunction() { + return this.aggregationFunction; + } + + /** + * Get the execution type that is used to filter the query instances that are returned. Possible values include: 'any', 'regular', 'irregular', 'aborted', 'exception'. + * + * @return the executionType value + */ + public QueryExecutionType executionType() { + return this.executionType; + } + + /** + * Get the duration of the interval (ISO8601 duration format). + * + * @return the intervalType value + */ + public String intervalType() { + return this.intervalType; + } + + /** + * Get the number of requested queries. + * + * @return the numberOfTopQueries value + */ + public Double numberOfTopQueries() { + return this.numberOfTopQueries; + } + + /** + * Get the start time for queries that are returned (ISO8601 format). + * + * @return the observationStartTime value + */ + public DateTime observationStartTime() { + return this.observationStartTime; + } + + /** + * Get the end time for queries that are returned (ISO8601 format). + * + * @return the observationEndTime value + */ + public DateTime observationEndTime() { + return this.observationEndTime; + } + + /** + * Get the type of metric to use for ordering the top metrics. Possible values include: 'cpu', 'io', 'logio', 'duration', 'executionCount'. + * + * @return the observedMetric value + */ + public QueryObservedMetricType observedMetric() { + return this.observedMetric; + } + + /** + * Get the list of queries. + * + * @return the queries value + */ + public List queries() { + return this.queries; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsImpl.java new file mode 100644 index 0000000000000..73747c354deb5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionConfigurations; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryption; + +class TransparentDataEncryptionConfigurationsImpl extends WrapperImpl implements TransparentDataEncryptionConfigurations { + private final SqlManager manager; + + TransparentDataEncryptionConfigurationsImpl(SqlManager manager) { + super(manager.inner().transparentDataEncryptionConfigurations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionConfigurationsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public TransparentDataEncryption call(TransparentDataEncryptionInner inner) { + return new TransparentDataEncryptionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsInner.java new file mode 100644 index 0000000000000..f333fa04393ca --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionConfigurationsInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TransparentDataEncryptionConfigurations. + */ +public class TransparentDataEncryptionConfigurationsInner { + /** The Retrofit service to perform REST calls. */ + private TransparentDataEncryptionConfigurationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionConfigurationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransparentDataEncryptionConfigurationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TransparentDataEncryptionConfigurationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TransparentDataEncryptionConfigurations to be + * used by Retrofit to perform actually REST calls. + */ + interface TransparentDataEncryptionConfigurationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionConfigurations listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of a database's transparent data encryption configurations. There is only ever one element, named 'current', so GetTransparentDataEncryptionConfiguration should be used instead. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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 List<TransparentDataEncryptionInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of a database's transparent data encryption configurations. There is only ever one element, named 'current', so GetTransparentDataEncryptionConfiguration should be used instead. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of a database's transparent data encryption configurations. There is only ever one element, named 'current', so GetTransparentDataEncryptionConfiguration should be used instead. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of a database's transparent data encryption configurations. There is only ever one element, named 'current', so GetTransparentDataEncryptionConfiguration should be used instead. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/pom.xml b/sql/resource-manager/v2015_05_01_preview/pom.xml new file mode 100644 index 0000000000000..609302797e800 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v2015_05_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AdvisorStatus.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AdvisorStatus.java new file mode 100644 index 0000000000000..fb18d0f411ecd --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AdvisorStatus.java @@ -0,0 +1,59 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AdvisorStatus. + */ +public enum AdvisorStatus { + /** Enum value GA. */ + GA("GA"), + + /** Enum value PublicPreview. */ + PUBLIC_PREVIEW("PublicPreview"), + + /** Enum value LimitedPublicPreview. */ + LIMITED_PUBLIC_PREVIEW("LimitedPublicPreview"), + + /** Enum value PrivatePreview. */ + PRIVATE_PREVIEW("PrivatePreview"); + + /** The actual serialized value for a AdvisorStatus instance. */ + private String value; + + AdvisorStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdvisorStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AdvisorStatus object, or null if unable to parse. + */ + @JsonCreator + public static AdvisorStatus fromString(String value) { + AdvisorStatus[] items = AdvisorStatus.values(); + for (AdvisorStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatus.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatus.java new file mode 100644 index 0000000000000..6311478de2b8d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatus.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutoExecuteStatus. + */ +public enum AutoExecuteStatus { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutoExecuteStatus instance. */ + private String value; + + AutoExecuteStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutoExecuteStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AutoExecuteStatus object, or null if unable to parse. + */ + @JsonCreator + public static AutoExecuteStatus fromString(String value) { + AutoExecuteStatus[] items = AutoExecuteStatus.values(); + for (AutoExecuteStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatusInheritedFrom.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatusInheritedFrom.java new file mode 100644 index 0000000000000..37c9a2450d866 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutoExecuteStatusInheritedFrom.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutoExecuteStatusInheritedFrom. + */ +public enum AutoExecuteStatusInheritedFrom { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Subscription. */ + SUBSCRIPTION("Subscription"), + + /** Enum value Server. */ + SERVER("Server"), + + /** Enum value ElasticPool. */ + ELASTIC_POOL("ElasticPool"), + + /** Enum value Database. */ + DATABASE("Database"); + + /** The actual serialized value for a AutoExecuteStatusInheritedFrom instance. */ + private String value; + + AutoExecuteStatusInheritedFrom(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutoExecuteStatusInheritedFrom instance. + * + * @param value the serialized value to parse. + * @return the parsed AutoExecuteStatusInheritedFrom object, or null if unable to parse. + */ + @JsonCreator + public static AutoExecuteStatusInheritedFrom fromString(String value) { + AutoExecuteStatusInheritedFrom[] items = AutoExecuteStatusInheritedFrom.values(); + for (AutoExecuteStatusInheritedFrom item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningDisabledReason.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningDisabledReason.java new file mode 100644 index 0000000000000..52d15dc64dffa --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningDisabledReason.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningDisabledReason. + */ +public enum AutomaticTuningDisabledReason { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value AutoConfigured. */ + AUTO_CONFIGURED("AutoConfigured"), + + /** Enum value InheritedFromServer. */ + INHERITED_FROM_SERVER("InheritedFromServer"), + + /** Enum value QueryStoreOff. */ + QUERY_STORE_OFF("QueryStoreOff"), + + /** Enum value QueryStoreReadOnly. */ + QUERY_STORE_READ_ONLY("QueryStoreReadOnly"), + + /** Enum value NotSupported. */ + NOT_SUPPORTED("NotSupported"); + + /** The actual serialized value for a AutomaticTuningDisabledReason instance. */ + private String value; + + AutomaticTuningDisabledReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningDisabledReason instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningDisabledReason object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningDisabledReason fromString(String value) { + AutomaticTuningDisabledReason[] items = AutomaticTuningDisabledReason.values(); + for (AutomaticTuningDisabledReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningMode.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningMode.java new file mode 100644 index 0000000000000..8cfb0a95b3103 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningMode.java @@ -0,0 +1,59 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningMode. + */ +public enum AutomaticTuningMode { + /** Enum value Inherit. */ + INHERIT("Inherit"), + + /** Enum value Custom. */ + CUSTOM("Custom"), + + /** Enum value Auto. */ + AUTO("Auto"), + + /** Enum value Unspecified. */ + UNSPECIFIED("Unspecified"); + + /** The actual serialized value for a AutomaticTuningMode instance. */ + private String value; + + AutomaticTuningMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningMode object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningMode fromString(String value) { + AutomaticTuningMode[] items = AutomaticTuningMode.values(); + for (AutomaticTuningMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeActual.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeActual.java new file mode 100644 index 0000000000000..56f6777d4c6e6 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeActual.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeActual. + */ +public enum AutomaticTuningOptionModeActual { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"); + + /** The actual serialized value for a AutomaticTuningOptionModeActual instance. */ + private String value; + + AutomaticTuningOptionModeActual(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeActual instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeActual object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeActual fromString(String value) { + AutomaticTuningOptionModeActual[] items = AutomaticTuningOptionModeActual.values(); + for (AutomaticTuningOptionModeActual item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeDesired.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeDesired.java new file mode 100644 index 0000000000000..39f50da5502b4 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptionModeDesired.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeDesired. + */ +public enum AutomaticTuningOptionModeDesired { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutomaticTuningOptionModeDesired instance. */ + private String value; + + AutomaticTuningOptionModeDesired(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeDesired instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeDesired object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeDesired fromString(String value) { + AutomaticTuningOptionModeDesired[] items = AutomaticTuningOptionModeDesired.values(); + for (AutomaticTuningOptionModeDesired item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptions.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptions.java new file mode 100644 index 0000000000000..b258ca545ac38 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/AutomaticTuningOptions.java @@ -0,0 +1,93 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Automatic tuning properties for individual advisors. + */ +public class AutomaticTuningOptions { + /** + * Automatic tuning option desired state. Possible values include: 'Off', + * 'On', 'Default'. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /** + * Automatic tuning option actual state. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningOptionModeActual actualState; + + /** + * Reason code if desired and actual state are different. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer reasonCode; + + /** + * Reason description if desired and actual state are different. Possible + * values include: 'Default', 'Disabled', 'AutoConfigured', + * 'InheritedFromServer', 'QueryStoreOff', 'QueryStoreReadOnly', + * 'NotSupported'. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningDisabledReason reasonDesc; + + /** + * Get automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @return the desiredState value + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @param desiredState the desiredState value to set + * @return the AutomaticTuningOptions object itself. + */ + public AutomaticTuningOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning option actual state. Possible values include: 'Off', 'On'. + * + * @return the actualState value + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get reason code if desired and actual state are different. + * + * @return the reasonCode value + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get reason description if desired and actual state are different. Possible values include: 'Default', 'Disabled', 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', 'QueryStoreReadOnly', 'NotSupported'. + * + * @return the reasonDesc value + */ + public AutomaticTuningDisabledReason reasonDesc() { + return this.reasonDesc; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/BlobAuditingPolicyState.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/BlobAuditingPolicyState.java new file mode 100644 index 0000000000000..6bdb317defd29 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/BlobAuditingPolicyState.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for BlobAuditingPolicyState. + */ +public enum BlobAuditingPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a BlobAuditingPolicyState instance. */ + private String value; + + BlobAuditingPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BlobAuditingPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed BlobAuditingPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static BlobAuditingPolicyState fromString(String value) { + BlobAuditingPolicyState[] items = BlobAuditingPolicyState.values(); + for (BlobAuditingPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAdvisors.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAdvisors.java new file mode 100644 index 0000000000000..de406365ec632 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAdvisors.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.v2015_05_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.DatabaseAdvisorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseAdvisors. + */ +public interface DatabaseAdvisors extends HasInner { + /** + * Gets a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTuning.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTuning.java new file mode 100644 index 0000000000000..b716a8c82add3 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTuning.java @@ -0,0 +1,51 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.DatabaseAutomaticTuningInner; +import java.util.Map; + +/** + * Type representing DatabaseAutomaticTuning. + */ +public interface DatabaseAutomaticTuning extends HasInner, HasManager { + /** + * @return the actualState value. + */ + AutomaticTuningMode actualState(); + + /** + * @return the desiredState value. + */ + AutomaticTuningMode desiredState(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the options value. + */ + Map options(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTunings.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTunings.java new file mode 100644 index 0000000000000..781e2aa5f1c54 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseAutomaticTunings.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.v2015_05_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.DatabaseAutomaticTuningInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.DatabaseAutomaticTuningsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseAutomaticTunings. + */ +public interface DatabaseAutomaticTunings extends HasInner { + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..70855776d91e7 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.DatabaseBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseBlobAuditingPolicies. + */ +public interface DatabaseBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..209d78a5633d1 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java @@ -0,0 +1,282 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.DatabaseBlobAuditingPolicyInner; +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.v2015_05_01_preview.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing DatabaseBlobAuditingPolicy. + */ +public interface DatabaseBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseBlobAuditingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a DatabaseBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of DatabaseBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databaseblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseRecommendedActions.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseRecommendedActions.java new file mode 100644 index 0000000000000..fd65d544f5df1 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseRecommendedActions.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.v2015_05_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.DatabaseRecommendedActionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseRecommendedActions. + */ +public interface DatabaseRecommendedActions extends HasInner { + /** + * Gets a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName); + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabasisServerAdvisor.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabasisServerAdvisor.java new file mode 100644 index 0000000000000..06b79609291f0 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabasisServerAdvisor.java @@ -0,0 +1,102 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.AdvisorInner; +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.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing DatabasisServerAdvisor. + */ +public interface DatabasisServerAdvisor extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the advisorStatus value. + */ + AdvisorStatus advisorStatus(); + + /** + * @return the autoExecuteStatus value. + */ + AutoExecuteStatus autoExecuteStatus(); + + /** + * @return the autoExecuteStatusInheritedFrom value. + */ + AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the lastChecked value. + */ + DateTime lastChecked(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recommendationsStatus value. + */ + String recommendationsStatus(); + + /** + * @return the recommendedActions value. + */ + List recommendedActions(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a DatabasisServerAdvisor update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoExecuteStatus { + } + + /** + * Grouping of DatabasisServerAdvisor update stages. + */ + interface UpdateStages { + /** + * The stage of the databasisserveradvisor update allowing to specify AutoExecuteStatus. + */ + interface WithAutoExecuteStatus { + /** + * Specifies autoExecuteStatus. + */ + Update withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtector.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtector.java new file mode 100644 index 0000000000000..15636a3fb1072 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtector.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.EncryptionProtectorInner; + +/** + * Type representing EncryptionProtector. + */ +public interface EncryptionProtector extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the subregion value. + */ + String subregion(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java new file mode 100644 index 0000000000000..1d29b5ef76574 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java @@ -0,0 +1,51 @@ +/** + * 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.v2015_05_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.EncryptionProtectorInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.EncryptionProtectorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EncryptionProtectors. + */ +public interface EncryptionProtectors extends HasInner { + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The 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); + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The 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); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroup.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroup.java new file mode 100644 index 0000000000000..2e5778aa92f14 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroup.java @@ -0,0 +1,217 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.FailoverGroupInner; +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.v2015_05_01_preview.implementation.SqlManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing FailoverGroup. + */ +public interface FailoverGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the databases value. + */ + List databases(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerServers value. + */ + List partnerServers(); + + /** + * @return the readOnlyEndpoint value. + */ + FailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * @return the readWriteEndpoint value. + */ + FailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * @return the replicationRole value. + */ + FailoverGroupReplicationRole replicationRole(); + + /** + * @return the replicationState value. + */ + String replicationState(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FailoverGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithPartnerServers, DefinitionStages.WithReadWriteEndpoint, DefinitionStages.WithCreate { + } + + /** + * Grouping of FailoverGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FailoverGroup definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the failovergroup definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithPartnerServers withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the failovergroup definition allowing to specify PartnerServers. + */ + interface WithPartnerServers { + /** + * Specifies partnerServers. + */ + WithReadWriteEndpoint withPartnerServers(List partnerServers); + } + + /** + * The stage of the failovergroup definition allowing to specify ReadWriteEndpoint. + */ + interface WithReadWriteEndpoint { + /** + * Specifies readWriteEndpoint. + */ + WithCreate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + + /** + * The stage of the failovergroup definition allowing to specify Databases. + */ + interface WithDatabases { + /** + * Specifies databases. + */ + WithCreate withDatabases(List databases); + } + + /** + * The stage of the failovergroup definition allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + WithCreate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + /** + * The stage of the failovergroup definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + 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.WithDatabases, DefinitionStages.WithReadOnlyEndpoint, DefinitionStages.WithTags { + } + } + /** + * The template for a FailoverGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDatabases, UpdateStages.WithReadOnlyEndpoint, UpdateStages.WithReadWriteEndpoint, UpdateStages.WithTags { + } + + /** + * Grouping of FailoverGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the failovergroup update allowing to specify Databases. + */ + interface WithDatabases { + /** + * Specifies databases. + */ + Update withDatabases(List databases); + } + + /** + * The stage of the failovergroup update allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + Update withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + /** + * The stage of the failovergroup update allowing to specify ReadWriteEndpoint. + */ + interface WithReadWriteEndpoint { + /** + * Specifies readWriteEndpoint. + */ + Update withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + + /** + * The stage of the failovergroup update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadOnlyEndpoint.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..167df14aa8087 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadOnlyEndpoint.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-only endpoint of the failover group instance. + */ +public class FailoverGroupReadOnlyEndpoint { + /** + * Failover policy of the read-only endpoint for the failover group. + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @return the failoverPolicy value + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the FailoverGroupReadOnlyEndpoint object itself. + */ + public FailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadWriteEndpoint.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..3e489254ae677 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReadWriteEndpoint.java @@ -0,0 +1,73 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-write endpoint of the failover group instance. + */ +public class FailoverGroupReadWriteEndpoint { + /** + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /** + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @return the failoverPolicy value + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the FailoverGroupReadWriteEndpoint object itself. + */ + public FailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverWithDataLossGracePeriodMinutes value + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set + * @return the FailoverGroupReadWriteEndpoint object itself. + */ + public FailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes(Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReplicationRole.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..31e7a692127b0 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupReplicationRole.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FailoverGroupReplicationRole. + */ +public final class FailoverGroupReplicationRole extends ExpandableStringEnum { + /** Static value Primary for FailoverGroupReplicationRole. */ + public static final FailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for FailoverGroupReplicationRole. */ + public static final FailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a FailoverGroupReplicationRole from its string representation. + * @param name a name to look for + * @return the corresponding FailoverGroupReplicationRole + */ + @JsonCreator + public static FailoverGroupReplicationRole fromString(String name) { + return fromString(name, FailoverGroupReplicationRole.class); + } + + /** + * @return known FailoverGroupReplicationRole values + */ + public static Collection values() { + return values(FailoverGroupReplicationRole.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupUpdate.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupUpdate.java new file mode 100644 index 0000000000000..ef9d54cfd9530 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroupUpdate.java @@ -0,0 +1,125 @@ +/** + * 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.v2015_05_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A failover group update request. + */ +@JsonFlatten +public class FailoverGroupUpdate { + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint") + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * List of databases in the failover group. + */ + @JsonProperty(value = "properties.databases") + private List databases; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get list of databases in the failover group. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Set list of databases in the failover group. + * + * @param databases the databases value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withDatabases(List databases) { + this.databases = databases; + 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 FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroups.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroups.java new file mode 100644 index 0000000000000..a72bbceba93e8 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FailoverGroups.java @@ -0,0 +1,75 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.FailoverGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FailoverGroups. + */ +public interface FailoverGroups extends SupportsCreating, HasInner { + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable failoverAsync(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String failoverGroupName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRule.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRule.java new file mode 100644 index 0000000000000..e543a671f20bc --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRule.java @@ -0,0 +1,135 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.FirewallRuleInner; +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.v2015_05_01_preview.implementation.SqlManager; + +/** + * Type representing FirewallRule. + */ +public interface FirewallRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FirewallRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallRule definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the firewallrule definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the firewallrule definition allowing to specify EndIpAddress. + */ + interface WithEndIpAddress { + /** + * Specifies endIpAddress. + */ + WithCreate withEndIpAddress(String endIpAddress); + } + + /** + * The stage of the firewallrule definition allowing to specify StartIpAddress. + */ + interface WithStartIpAddress { + /** + * Specifies startIpAddress. + */ + WithCreate withStartIpAddress(String startIpAddress); + } + + /** + * 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.WithEndIpAddress, DefinitionStages.WithStartIpAddress { + } + } + /** + * The template for a FirewallRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithEndIpAddress, UpdateStages.WithStartIpAddress { + } + + /** + * Grouping of FirewallRule update stages. + */ + interface UpdateStages { + /** + * The stage of the firewallrule update allowing to specify EndIpAddress. + */ + interface WithEndIpAddress { + /** + * Specifies endIpAddress. + */ + Update withEndIpAddress(String endIpAddress); + } + + /** + * The stage of the firewallrule update allowing to specify StartIpAddress. + */ + interface WithStartIpAddress { + /** + * Specifies startIpAddress. + */ + Update withStartIpAddress(String startIpAddress); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRuleList.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRuleList.java new file mode 100644 index 0000000000000..eff3721004f6c --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRuleList.java @@ -0,0 +1,45 @@ +/** + * 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.v2015_05_01_preview; + +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list of server firewall rules. + */ +public class FirewallRuleList { + /** + * The values property. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the values value. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the values value. + * + * @param values the values value to set + * @return the FirewallRuleList object itself. + */ + public FirewallRuleList withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRules.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRules.java new file mode 100644 index 0000000000000..208e51a659923 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/FirewallRules.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.FirewallRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallRules. + */ +public interface FirewallRules extends SupportsCreating, HasInner { + /** + * Replaces all firewall rules on the 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 replaceAsync(String resourceGroupName, String serverName); + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets a list of firewall rules. + * + * @param resourceGroupName The 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 firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/IdentityType.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/IdentityType.java new file mode 100644 index 0000000000000..ef6c2cead3a4c --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_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.v2015_05_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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ImplementationMethod.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ImplementationMethod.java new file mode 100644 index 0000000000000..0b31141966d55 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ImplementationMethod.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ImplementationMethod. + */ +public enum ImplementationMethod { + /** Enum value TSql. */ + TSQL("TSql"), + + /** Enum value AzurePowerShell. */ + AZURE_POWER_SHELL("AzurePowerShell"); + + /** The actual serialized value for a ImplementationMethod instance. */ + private String value; + + ImplementationMethod(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ImplementationMethod instance. + * + * @param value the serialized value to parse. + * @return the parsed ImplementationMethod object, or null if unable to parse. + */ + @JsonCreator + public static ImplementationMethod fromString(String value) { + ImplementationMethod[] items = ImplementationMethod.values(); + for (ImplementationMethod item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/IsRetryable.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/IsRetryable.java new file mode 100644 index 0000000000000..01a0521619a87 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/IsRetryable.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IsRetryable. + */ +public enum IsRetryable { + /** Enum value Yes. */ + YES("Yes"), + + /** Enum value No. */ + NO("No"); + + /** The actual serialized value for a IsRetryable instance. */ + private String value; + + IsRetryable(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IsRetryable instance. + * + * @param value the serialized value to parse. + * @return the parsed IsRetryable object, or null if unable to parse. + */ + @JsonCreator + public static IsRetryable fromString(String value) { + IsRetryable[] items = IsRetryable.values(); + for (IsRetryable item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java new file mode 100644 index 0000000000000..7ac575c97308d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java @@ -0,0 +1,323 @@ +/** + * 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.v2015_05_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.v2015_05_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.ManagedInstanceInner; + +/** + * Type representing ManagedInstance. + */ +public interface ManagedInstance extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, 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 identity value. + */ + ResourceIdentity identity(); + + /** + * @return the licenseType value. + */ + String licenseType(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the storageSizeInGB value. + */ + Integer storageSizeInGB(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * @return the vCores value. + */ + Integer vCores(); + + /** + * The entirety of the ManagedInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstance definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstance definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ManagedInstance definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the managedinstance update allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the managedinstance update allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the managedinstance update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the managedinstance update allowing to specify DnsZonePartner. + */ + interface WithDnsZonePartner { + /** + * Specifies dnsZonePartner. + */ + WithCreate withDnsZonePartner(String dnsZonePartner); + } + + /** + * The stage of the managedinstance update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + + /** + * The stage of the managedinstance update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(String licenseType); + } + + /** + * The stage of the managedinstance update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the managedinstance update allowing to specify StorageSizeInGB. + */ + interface WithStorageSizeInGB { + /** + * Specifies storageSizeInGB. + */ + WithCreate withStorageSizeInGB(Integer storageSizeInGB); + } + + /** + * The stage of the managedinstance update allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + */ + WithCreate withSubnetId(String subnetId); + } + + /** + * The stage of the managedinstance update allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + */ + 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, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores { + } + } + /** + * The template for a ManagedInstance update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithVCores { + } + + /** + * Grouping of ManagedInstance update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstance {0} allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + Update withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the managedinstance {0} allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the managedinstance {0} allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the managedinstance {0} allowing to specify DnsZonePartner. + */ + interface WithDnsZonePartner { + /** + * Specifies dnsZonePartner. + */ + Update withDnsZonePartner(String dnsZonePartner); + } + + /** + * The stage of the managedinstance {0} allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(String licenseType); + } + + /** + * The stage of the managedinstance {0} allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the managedinstance {0} allowing to specify StorageSizeInGB. + */ + interface WithStorageSizeInGB { + /** + * Specifies storageSizeInGB. + */ + Update withStorageSizeInGB(Integer storageSizeInGB); + } + + /** + * The stage of the managedinstance {0} allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + */ + Update withSubnetId(String subnetId); + } + + /** + * The stage of the managedinstance {0} allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + */ + Update withVCores(Integer vCores); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java new file mode 100644 index 0000000000000..9e4b6b717db42 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java @@ -0,0 +1,329 @@ +/** + * 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.v2015_05_01_preview; + +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; + + /** + * 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' and 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * The number of VCores. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * The maximum storage size in GB. + */ + @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; + + /** + * 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 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' and 'BasePrice'. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the number of VCores. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the number of VCores. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the maximum storage size in GB. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the maximum storage size in GB. + * + * @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 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.java new file mode 100644 index 0000000000000..c3949792e1987 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.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.v2015_05_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.v2015_05_01_preview.implementation.ManagedInstancesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstances. + */ +public interface ManagedInstances extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operation.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operation.java new file mode 100644 index 0000000000000..9f7b997e2ba64 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operation.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.OperationInner; +import java.util.Map; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + OperationOrigin origin(); + + /** + * @return the properties value. + */ + Map properties(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationDisplay.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationDisplay.java new file mode 100644 index 0000000000000..f7ec8ca3faca9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationDisplay.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * The localized friendly form of the resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * The localized friendly form of the resource type related to this + * action/operation. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * The localized friendly name for the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The localized friendly description for the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the localized friendly form of the resource provider name. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the localized friendly form of the resource type related to this action/operation. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the localized friendly name for the operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the localized friendly description for the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationOrigin.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationOrigin.java new file mode 100644 index 0000000000000..a2dd01c406f63 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/OperationOrigin.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OperationOrigin. + */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * @param name a name to look for + * @return the corresponding OperationOrigin + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** + * @return known OperationOrigin values + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operations.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operations.java new file mode 100644 index 0000000000000..95f03a4300c4e --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.v2015_05_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/PartnerInfo.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/PartnerInfo.java new file mode 100644 index 0000000000000..e1db40db54208 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/PartnerInfo.java @@ -0,0 +1,74 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Partner server information for the failover group. + */ +public class PartnerInfo { + /** + * Resource identifier of the partner server. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Geo location of the partner server. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Replication role of the partner server. Possible values include: + * 'Primary', 'Secondary'. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /** + * Get resource identifier of the partner server. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource identifier of the partner server. + * + * @param id the id value to set + * @return the PartnerInfo object itself. + */ + public PartnerInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get geo location of the partner server. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get replication role of the partner server. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ProxyResourceWithWritableName.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ProxyResourceWithWritableName.java new file mode 100644 index 0000000000000..7208faf1e23c2 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ProxyResourceWithWritableName.java @@ -0,0 +1,16 @@ +/** + * 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.v2015_05_01_preview; + + +/** + * ARM proxy resource. + */ +public class ProxyResourceWithWritableName extends ResourceWithWritableName { +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadOnlyEndpointFailoverPolicy.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadOnlyEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..85c2d68da1c73 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadOnlyEndpointFailoverPolicy.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadOnlyEndpointFailoverPolicy. + */ +public final class ReadOnlyEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Disabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy DISABLED = fromString("Disabled"); + + /** Static value Enabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy ENABLED = fromString("Enabled"); + + /** + * Creates or finds a ReadOnlyEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadOnlyEndpointFailoverPolicy + */ + @JsonCreator + public static ReadOnlyEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadOnlyEndpointFailoverPolicy.class); + } + + /** + * @return known ReadOnlyEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadOnlyEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadWriteEndpointFailoverPolicy.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadWriteEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..841b45a4df045 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ReadWriteEndpointFailoverPolicy.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadWriteEndpointFailoverPolicy. + */ +public final class ReadWriteEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Manual for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy MANUAL = fromString("Manual"); + + /** Static value Automatic for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a ReadWriteEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadWriteEndpointFailoverPolicy + */ + @JsonCreator + public static ReadWriteEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadWriteEndpointFailoverPolicy.class); + } + + /** + * @return known ReadWriteEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadWriteEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedAction.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedAction.java new file mode 100644 index 0000000000000..1406a8368ce49 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedAction.java @@ -0,0 +1,188 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.RecommendedActionInner; +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.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.Map; +import java.util.List; + +/** + * Type representing RecommendedAction. + */ +public interface RecommendedAction extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the details value. + */ + Map details(); + + /** + * @return the errorDetails value. + */ + RecommendedActionErrorInfo errorDetails(); + + /** + * @return the estimatedImpact value. + */ + List estimatedImpact(); + + /** + * @return the executeActionDuration value. + */ + String executeActionDuration(); + + /** + * @return the executeActionInitiatedBy value. + */ + RecommendedActionInitiatedBy executeActionInitiatedBy(); + + /** + * @return the executeActionInitiatedTime value. + */ + DateTime executeActionInitiatedTime(); + + /** + * @return the executeActionStartTime value. + */ + DateTime executeActionStartTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the implementationDetails value. + */ + RecommendedActionImplementationInfo implementationDetails(); + + /** + * @return the isArchivedAction value. + */ + Boolean isArchivedAction(); + + /** + * @return the isExecutableAction value. + */ + Boolean isExecutableAction(); + + /** + * @return the isRevertableAction value. + */ + Boolean isRevertableAction(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the lastRefresh value. + */ + DateTime lastRefresh(); + + /** + * @return the linkedObjects value. + */ + List linkedObjects(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the observedImpact value. + */ + List observedImpact(); + + /** + * @return the recommendationReason value. + */ + String recommendationReason(); + + /** + * @return the revertActionDuration value. + */ + String revertActionDuration(); + + /** + * @return the revertActionInitiatedBy value. + */ + RecommendedActionInitiatedBy revertActionInitiatedBy(); + + /** + * @return the revertActionInitiatedTime value. + */ + DateTime revertActionInitiatedTime(); + + /** + * @return the revertActionStartTime value. + */ + DateTime revertActionStartTime(); + + /** + * @return the score value. + */ + Integer score(); + + /** + * @return the state value. + */ + RecommendedActionStateInfo state(); + + /** + * @return the timeSeries value. + */ + List timeSeries(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the validSince value. + */ + DateTime validSince(); + + /** + * The template for a RecommendedAction update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithState { + } + + /** + * Grouping of RecommendedAction update stages. + */ + interface UpdateStages { + /** + * The stage of the recommendedaction update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + Update withState(RecommendedActionStateInfo state); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionCurrentState.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionCurrentState.java new file mode 100644 index 0000000000000..0dd471790051b --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionCurrentState.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. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for RecommendedActionCurrentState. + */ +public final class RecommendedActionCurrentState extends ExpandableStringEnum { + /** Static value Active for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState ACTIVE = fromString("Active"); + + /** Static value Pending for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState PENDING = fromString("Pending"); + + /** Static value Executing for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState EXECUTING = fromString("Executing"); + + /** Static value Verifying for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState VERIFYING = fromString("Verifying"); + + /** Static value PendingRevert for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState PENDING_REVERT = fromString("PendingRevert"); + + /** Static value RevertCancelled for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState REVERT_CANCELLED = fromString("RevertCancelled"); + + /** Static value Reverting for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState REVERTING = fromString("Reverting"); + + /** Static value Reverted for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState REVERTED = fromString("Reverted"); + + /** Static value Ignored for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState IGNORED = fromString("Ignored"); + + /** Static value Expired for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState EXPIRED = fromString("Expired"); + + /** Static value Monitoring for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState MONITORING = fromString("Monitoring"); + + /** Static value Resolved for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState RESOLVED = fromString("Resolved"); + + /** Static value Success for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState SUCCESS = fromString("Success"); + + /** Static value Error for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState ERROR = fromString("Error"); + + /** + * Creates or finds a RecommendedActionCurrentState from its string representation. + * @param name a name to look for + * @return the corresponding RecommendedActionCurrentState + */ + @JsonCreator + public static RecommendedActionCurrentState fromString(String name) { + return fromString(name, RecommendedActionCurrentState.class); + } + + /** + * @return known RecommendedActionCurrentState values + */ + public static Collection values() { + return values(RecommendedActionCurrentState.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionErrorInfo.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionErrorInfo.java new file mode 100644 index 0000000000000..4199afcac64b5 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionErrorInfo.java @@ -0,0 +1,51 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains error information for an Azure SQL Database, Server or Elastic Pool + * Recommended Action. + */ +public class RecommendedActionErrorInfo { + /** + * Gets the reason why the recommended action was put to error state. e.g., + * DatabaseHasQdsOff, IndexAlreadyExists. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private String errorCode; + + /** + * Gets whether the error could be ignored and recommended action could be + * retried. Possible values are: Yes/No. Possible values include: 'Yes', + * 'No'. + */ + @JsonProperty(value = "isRetryable", access = JsonProperty.Access.WRITE_ONLY) + private IsRetryable isRetryable; + + /** + * Get gets the reason why the recommended action was put to error state. e.g., DatabaseHasQdsOff, IndexAlreadyExists. + * + * @return the errorCode value + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No. Possible values include: 'Yes', 'No'. + * + * @return the isRetryable value + */ + public IsRetryable isRetryable() { + return this.isRetryable; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImpactRecord.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImpactRecord.java new file mode 100644 index 0000000000000..567303d6d7da2 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImpactRecord.java @@ -0,0 +1,98 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information of estimated or observed impact on various metrics for + * an Azure SQL Database, Server or Elastic Pool Recommended Action. + */ +public class RecommendedActionImpactRecord { + /** + * Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + */ + @JsonProperty(value = "dimensionName", access = JsonProperty.Access.WRITE_ONLY) + private String dimensionName; + + /** + * Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Gets the absolute value of this dimension if applicable. e.g., Number of + * Queries affected. + */ + @JsonProperty(value = "absoluteValue", access = JsonProperty.Access.WRITE_ONLY) + private Double absoluteValue; + + /** + * Gets the absolute change in the value of this dimension. e.g., Absolute + * Disk space change in Megabytes. + */ + @JsonProperty(value = "changeValueAbsolute", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueAbsolute; + + /** + * Gets the relative change in the value of this dimension. e.g., Relative + * Disk space change in Percentage. + */ + @JsonProperty(value = "changeValueRelative", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueRelative; + + /** + * Get gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + * + * @return the dimensionName value + */ + public String dimensionName() { + return this.dimensionName; + } + + /** + * Get gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get gets the absolute value of this dimension if applicable. e.g., Number of Queries affected. + * + * @return the absoluteValue value + */ + public Double absoluteValue() { + return this.absoluteValue; + } + + /** + * Get gets the absolute change in the value of this dimension. e.g., Absolute Disk space change in Megabytes. + * + * @return the changeValueAbsolute value + */ + public Double changeValueAbsolute() { + return this.changeValueAbsolute; + } + + /** + * Get gets the relative change in the value of this dimension. e.g., Relative Disk space change in Percentage. + * + * @return the changeValueRelative value + */ + public Double changeValueRelative() { + return this.changeValueRelative; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImplementationInfo.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImplementationInfo.java new file mode 100644 index 0000000000000..ad767720b168d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionImplementationInfo.java @@ -0,0 +1,51 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information for manual implementation for an Azure SQL Database, + * Server or Elastic Pool Recommended Action. + */ +public class RecommendedActionImplementationInfo { + /** + * Gets the method in which this recommended action can be manually + * implemented. e.g., TSql, AzurePowerShell. Possible values include: + * 'TSql', 'AzurePowerShell'. + */ + @JsonProperty(value = "method", access = JsonProperty.Access.WRITE_ONLY) + private ImplementationMethod method; + + /** + * Gets the manual implementation script. e.g., T-SQL script that could be + * executed on the database. + */ + @JsonProperty(value = "script", access = JsonProperty.Access.WRITE_ONLY) + private String script; + + /** + * Get gets the method in which this recommended action can be manually implemented. e.g., TSql, AzurePowerShell. Possible values include: 'TSql', 'AzurePowerShell'. + * + * @return the method value + */ + public ImplementationMethod method() { + return this.method; + } + + /** + * Get gets the manual implementation script. e.g., T-SQL script that could be executed on the database. + * + * @return the script value + */ + public String script() { + return this.script; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionInitiatedBy.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionInitiatedBy.java new file mode 100644 index 0000000000000..bc3be9f6a82ad --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionInitiatedBy.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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedActionInitiatedBy. + */ +public enum RecommendedActionInitiatedBy { + /** Enum value User. */ + USER("User"), + + /** Enum value System. */ + SYSTEM("System"); + + /** The actual serialized value for a RecommendedActionInitiatedBy instance. */ + private String value; + + RecommendedActionInitiatedBy(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedActionInitiatedBy instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedActionInitiatedBy object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedActionInitiatedBy fromString(String value) { + RecommendedActionInitiatedBy[] items = RecommendedActionInitiatedBy.values(); + for (RecommendedActionInitiatedBy item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionMetricInfo.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionMetricInfo.java new file mode 100644 index 0000000000000..a0079d6cbea10 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionMetricInfo.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.v2015_05_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains time series of various impacted metrics for an Azure SQL Database, + * Server or Elastic Pool Recommended Action. + */ +public class RecommendedActionMetricInfo { + /** + * Gets the name of the metric. e.g., CPU, Number of Queries. + */ + @JsonProperty(value = "metricName", access = JsonProperty.Access.WRITE_ONLY) + private String metricName; + + /** + * Gets the unit in which metric is measured. e.g., DTU, Frequency. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Gets the duration of time interval for the value given by this + * MetricInfo. e.g., PT1H (1 hour). + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * Gets the start time of time interval given by this MetricInfo. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * Gets the value of the metric in the time interval given by this + * MetricInfo. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /** + * Get gets the name of the metric. e.g., CPU, Number of Queries. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Get gets the unit in which metric is measured. e.g., DTU, Frequency. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get gets the duration of time interval for the value given by this MetricInfo. e.g., PT1H (1 hour). + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get gets the start time of time interval given by this MetricInfo. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get gets the value of the metric in the time interval given by this MetricInfo. + * + * @return the value value + */ + public Double value() { + return this.value; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java new file mode 100644 index 0000000000000..15422cce9fb14 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java @@ -0,0 +1,95 @@ +/** + * 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.v2015_05_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information of current state for an Azure SQL Database, Server or + * Elastic Pool Recommended Action. + */ +public class RecommendedActionStateInfo { + /** + * Current state the recommended action is in. Some commonly used states + * are: Active -> recommended action is active and no action has + * been taken yet. Pending -> recommended action is approved for and + * is awaiting execution. Executing -> recommended action is being + * applied on the user database. Verifying -> recommended action was + * applied and is being verified of its usefulness by the system. Success + * -> recommended action was applied and improvement found during + * verification. Pending Revert -> verification found little or no + * improvement so recommended action is queued for revert or user has + * manually reverted. Reverting -> changes made while applying + * recommended action are being reverted on the user database. Reverted + * -> succesfully reverted the changes made by recommended action on + * user database. Ignored -> user explicitly ignored/discarded the + * recommended action. Possible values include: 'Active', 'Pending', + * 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', + * 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Monitoring', 'Resolved', + * 'Success', 'Error'. + */ + @JsonProperty(value = "currentValue", required = true) + private RecommendedActionCurrentState currentValue; + + /** + * Gets who initiated the execution of this recommended action. Possible + * Value are: User -> When user explicity notified system to apply + * the recommended action. System -> When auto-execute status of this + * advisor was set to 'Enabled', in which case the system applied it. + * Possible values include: 'User', 'System'. + */ + @JsonProperty(value = "actionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy actionInitiatedBy; + + /** + * Gets the time when the state was last modified. + */ + @JsonProperty(value = "lastModified", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModified; + + /** + * Get current state the recommended action is in. Some commonly used states are: Active -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved for and is awaiting execution. Executing -> recommended action is being applied on the user database. Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success -> recommended action was applied and improvement found during verification. Pending Revert -> verification found little or no improvement so recommended action is queued for revert or user has manually reverted. Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted -> succesfully reverted the changes made by recommended action on user database. Ignored -> user explicitly ignored/discarded the recommended action. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error'. + * + * @return the currentValue value + */ + public RecommendedActionCurrentState currentValue() { + return this.currentValue; + } + + /** + * Set current state the recommended action is in. Some commonly used states are: Active -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved for and is awaiting execution. Executing -> recommended action is being applied on the user database. Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success -> recommended action was applied and improvement found during verification. Pending Revert -> verification found little or no improvement so recommended action is queued for revert or user has manually reverted. Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted -> succesfully reverted the changes made by recommended action on user database. Ignored -> user explicitly ignored/discarded the recommended action. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error'. + * + * @param currentValue the currentValue value to set + * @return the RecommendedActionStateInfo object itself. + */ + public RecommendedActionStateInfo withCurrentValue(RecommendedActionCurrentState currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get gets who initiated the execution of this recommended action. Possible Value are: User -> When user explicity notified system to apply the recommended action. System -> When auto-execute status of this advisor was set to 'Enabled', in which case the system applied it. Possible values include: 'User', 'System'. + * + * @return the actionInitiatedBy value + */ + public RecommendedActionInitiatedBy actionInitiatedBy() { + return this.actionInitiatedBy; + } + + /** + * Get gets the time when the state was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ResourceIdentity.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ResourceIdentity.java new file mode 100644 index 0000000000000..2481cebedec2e --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_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.v2015_05_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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ResourceWithWritableName.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ResourceWithWritableName.java new file mode 100644 index 0000000000000..2aeb120204e48 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ResourceWithWritableName.java @@ -0,0 +1,17 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.ProxyResource; + +/** + * ARM resource. + */ +public class ResourceWithWritableName extends ProxyResource { +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Server.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Server.java new file mode 100644 index 0000000000000..21893c4e60d26 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Server.java @@ -0,0 +1,173 @@ +/** + * 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.v2015_05_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.v2015_05_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.ServerInner; + +/** + * Type representing Server. + */ +public interface Server extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the version value. + */ + String version(); + + /** + * The entirety of the Server definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Server definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Server definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Server definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the server update allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the server update allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the server update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + + /** + * The stage of the server update allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + */ + WithCreate withVersion(String version); + } + + /** + * 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.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithIdentity, DefinitionStages.WithVersion { + } + } + /** + * The template for a Server update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithVersion { + } + + /** + * Grouping of Server update stages. + */ + interface UpdateStages { + /** + * The stage of the server {0} allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + Update withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the server {0} allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the server {0} allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + */ + Update withVersion(String version); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisor.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisor.java new file mode 100644 index 0000000000000..f9fe60015d7e7 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisor.java @@ -0,0 +1,102 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.AdvisorInner; +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.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ServerAdvisor. + */ +public interface ServerAdvisor extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the advisorStatus value. + */ + AdvisorStatus advisorStatus(); + + /** + * @return the autoExecuteStatus value. + */ + AutoExecuteStatus autoExecuteStatus(); + + /** + * @return the autoExecuteStatusInheritedFrom value. + */ + AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the lastChecked value. + */ + DateTime lastChecked(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recommendationsStatus value. + */ + String recommendationsStatus(); + + /** + * @return the recommendedActions value. + */ + List recommendedActions(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a ServerAdvisor update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoExecuteStatus { + } + + /** + * Grouping of ServerAdvisor update stages. + */ + interface UpdateStages { + /** + * The stage of the serveradvisor update allowing to specify AutoExecuteStatus. + */ + interface WithAutoExecuteStatus { + /** + * Specifies autoExecuteStatus. + */ + Update withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisors.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisors.java new file mode 100644 index 0000000000000..0fd8901e83083 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerAdvisors.java @@ -0,0 +1,40 @@ +/** + * 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.v2015_05_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.ServerAdvisorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerAdvisors. + */ +public interface ServerAdvisors extends HasInner { + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String advisorName); + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKey.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKey.java new file mode 100644 index 0000000000000..31d92bcc993bb --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKey.java @@ -0,0 +1,211 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.ServerKeyInner; +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.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ServerKey. + */ +public interface ServerKey extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the subregion value. + */ + String subregion(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + + /** + * The entirety of the ServerKey definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithServerKeyType, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerKey definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerKey definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverkey definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithServerKeyType withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverkey definition allowing to specify ServerKeyType. + */ + interface WithServerKeyType { + /** + * Specifies serverKeyType. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + + /** + * The stage of the serverkey definition allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + */ + WithCreate withCreationDate(DateTime creationDate); + } + + /** + * The stage of the serverkey definition allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + */ + WithCreate withKind(String kind); + } + + /** + * The stage of the serverkey definition allowing to specify Thumbprint. + */ + interface WithThumbprint { + /** + * Specifies thumbprint. + */ + WithCreate withThumbprint(String thumbprint); + } + + /** + * The stage of the serverkey definition allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + WithCreate withUri(String uri); + } + + /** + * 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.WithCreationDate, DefinitionStages.WithKind, DefinitionStages.WithThumbprint, DefinitionStages.WithUri { + } + } + /** + * The template for a ServerKey update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCreationDate, UpdateStages.WithKind, UpdateStages.WithThumbprint, UpdateStages.WithUri { + } + + /** + * Grouping of ServerKey update stages. + */ + interface UpdateStages { + /** + * The stage of the serverkey update allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + */ + Update withCreationDate(DateTime creationDate); + } + + /** + * The stage of the serverkey update allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + */ + Update withKind(String kind); + } + + /** + * The stage of the serverkey update allowing to specify Thumbprint. + */ + interface WithThumbprint { + /** + * Specifies thumbprint. + */ + Update withThumbprint(String thumbprint); + } + + /** + * The stage of the serverkey update allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + Update withUri(String uri); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeyType.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeyType.java new file mode 100644 index 0000000000000..7dbfd66f4da7c --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeyType.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServerKeyType. + */ +public final class ServerKeyType extends ExpandableStringEnum { + /** Static value ServiceManaged for ServerKeyType. */ + public static final ServerKeyType SERVICE_MANAGED = fromString("ServiceManaged"); + + /** Static value AzureKeyVault for ServerKeyType. */ + public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates or finds a ServerKeyType from its string representation. + * @param name a name to look for + * @return the corresponding ServerKeyType + */ + @JsonCreator + public static ServerKeyType fromString(String name) { + return fromString(name, ServerKeyType.class); + } + + /** + * @return known ServerKeyType values + */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeys.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeys.java new file mode 100644 index 0000000000000..5d23261d51aed --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerKeys.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.ServerKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerKeys. + */ +public interface ServerKeys extends SupportsCreating, HasInner { + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String keyName); + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The 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 the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String keyName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerUpdate.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerUpdate.java new file mode 100644 index 0000000000000..e3c061c937a49 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ServerUpdate.java @@ -0,0 +1,155 @@ +/** + * 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.v2015_05_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database server. + */ +@JsonFlatten +public class ServerUpdate { + /** + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The version of the server. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * The state of the server. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the server. Once created it cannot be changed. + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for server creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version of the server. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version of the server. + * + * @param version the version value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state of the server. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * 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 ServerUpdate object itself. + */ + public ServerUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Servers.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Servers.java new file mode 100644 index 0000000000000..fa09de1cf292a --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Servers.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.v2015_05_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.v2015_05_01_preview.implementation.ServersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Servers. + */ +public interface Servers extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java new file mode 100644 index 0000000000000..70001af090796 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java @@ -0,0 +1,152 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the 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 if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsage.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsage.java new file mode 100644 index 0000000000000..5f27eb1fdc0b7 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsage.java @@ -0,0 +1,57 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SubscriptionUsageInner; +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.v2015_05_01_preview.implementation.SqlManager; + +/** + * Type representing SubscriptionUsage. + */ +public interface SubscriptionUsage extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsages.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsages.java new file mode 100644 index 0000000000000..85ee5420d8808 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SubscriptionUsages.java @@ -0,0 +1,37 @@ +/** + * 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.v2015_05_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsage; + +/** + * Type representing SubscriptionUsages. + */ +public interface SubscriptionUsages { + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String locationName, String usageName); + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String locationName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgent.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgent.java new file mode 100644 index 0000000000000..a6cc884da084d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgent.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncAgentInner; +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.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing SyncAgent. + */ +public interface SyncAgent extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the expiryTime value. + */ + DateTime expiryTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isUpToDate value. + */ + Boolean isUpToDate(); + + /** + * @return the lastAliveTime value. + */ + DateTime lastAliveTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + SyncAgentState state(); + + /** + * @return the syncAgentName value. + */ + String syncAgentName(); + + /** + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the version value. + */ + String version(); + + /** + * The entirety of the SyncAgent definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of SyncAgent definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SyncAgent definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the syncagent definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + + /** + * 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 { + } + } + /** + * The template for a SyncAgent update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of SyncAgent update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentKeyProperties.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentKeyProperties.java new file mode 100644 index 0000000000000..bc64bb3327736 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentKeyProperties.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncAgentKeyPropertiesInner; + +/** + * Type representing SyncAgentKeyProperties. + */ +public interface SyncAgentKeyProperties extends HasInner, HasManager { + /** + * @return the syncAgentKey value. + */ + String syncAgentKey(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentLinkedDatabase.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentLinkedDatabase.java new file mode 100644 index 0000000000000..5f7a11b390420 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentLinkedDatabase.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncAgentLinkedDatabaseInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; + +/** + * Type representing SyncAgentLinkedDatabase. + */ +public interface SyncAgentLinkedDatabase extends HasInner, HasManager { + /** + * @return the databaseId value. + */ + String databaseId(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userName value. + */ + String userName(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentState.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentState.java new file mode 100644 index 0000000000000..680d01ef8630e --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgentState.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncAgentState. + */ +public final class SyncAgentState extends ExpandableStringEnum { + /** Static value Online for SyncAgentState. */ + public static final SyncAgentState ONLINE = fromString("Online"); + + /** Static value Offline for SyncAgentState. */ + public static final SyncAgentState OFFLINE = fromString("Offline"); + + /** Static value NeverConnected for SyncAgentState. */ + public static final SyncAgentState NEVER_CONNECTED = fromString("NeverConnected"); + + /** + * Creates or finds a SyncAgentState from its string representation. + * @param name a name to look for + * @return the corresponding SyncAgentState + */ + @JsonCreator + public static SyncAgentState fromString(String name) { + return fromString(name, SyncAgentState.class); + } + + /** + * @return known SyncAgentState values + */ + public static Collection values() { + return values(SyncAgentState.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgents.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgents.java new file mode 100644 index 0000000000000..7014aca8b2892 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncAgents.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncAgentsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgentLinkedDatabase; + +/** + * Type representing SyncAgents. + */ +public interface SyncAgents extends SupportsCreating, HasInner { + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncConflictResolutionPolicy.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncConflictResolutionPolicy.java new file mode 100644 index 0000000000000..359b69e6620c2 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncConflictResolutionPolicy.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncConflictResolutionPolicy. + */ +public final class SyncConflictResolutionPolicy extends ExpandableStringEnum { + /** Static value HubWin for SyncConflictResolutionPolicy. */ + public static final SyncConflictResolutionPolicy HUB_WIN = fromString("HubWin"); + + /** Static value MemberWin for SyncConflictResolutionPolicy. */ + public static final SyncConflictResolutionPolicy MEMBER_WIN = fromString("MemberWin"); + + /** + * Creates or finds a SyncConflictResolutionPolicy from its string representation. + * @param name a name to look for + * @return the corresponding SyncConflictResolutionPolicy + */ + @JsonCreator + public static SyncConflictResolutionPolicy fromString(String name) { + return fromString(name, SyncConflictResolutionPolicy.class); + } + + /** + * @return known SyncConflictResolutionPolicy values + */ + public static Collection values() { + return values(SyncConflictResolutionPolicy.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDatabaseIdProperties.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDatabaseIdProperties.java new file mode 100644 index 0000000000000..a90864571c759 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDatabaseIdProperties.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncDatabaseIdPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; + +/** + * Type representing SyncDatabaseIdProperties. + */ +public interface SyncDatabaseIdProperties extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDirection.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDirection.java new file mode 100644 index 0000000000000..75329a5f7f55a --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncDirection.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncDirection. + */ +public final class SyncDirection extends ExpandableStringEnum { + /** Static value Bidirectional for SyncDirection. */ + public static final SyncDirection BIDIRECTIONAL = fromString("Bidirectional"); + + /** Static value OneWayMemberToHub for SyncDirection. */ + public static final SyncDirection ONE_WAY_MEMBER_TO_HUB = fromString("OneWayMemberToHub"); + + /** Static value OneWayHubToMember for SyncDirection. */ + public static final SyncDirection ONE_WAY_HUB_TO_MEMBER = fromString("OneWayHubToMember"); + + /** + * Creates or finds a SyncDirection from its string representation. + * @param name a name to look for + * @return the corresponding SyncDirection + */ + @JsonCreator + public static SyncDirection fromString(String name) { + return fromString(name, SyncDirection.class); + } + + /** + * @return known SyncDirection values + */ + public static Collection values() { + return values(SyncDirection.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTable.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTable.java new file mode 100644 index 0000000000000..2886e42b2ed77 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTable.java @@ -0,0 +1,93 @@ +/** + * 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.v2015_05_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the table in the database full schema. + */ +public class SyncFullSchemaTable { + /** + * List of columns in the table of database full schema. + */ + @JsonProperty(value = "columns", access = JsonProperty.Access.WRITE_ONLY) + private List columns; + + /** + * Error id of the table. + */ + @JsonProperty(value = "errorId", access = JsonProperty.Access.WRITE_ONLY) + private String errorId; + + /** + * If there is error in the table. + */ + @JsonProperty(value = "hasError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasError; + + /** + * Name of the table. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Quoted name of the table. + */ + @JsonProperty(value = "quotedName", access = JsonProperty.Access.WRITE_ONLY) + private String quotedName; + + /** + * Get list of columns in the table of database full schema. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Get error id of the table. + * + * @return the errorId value + */ + public String errorId() { + return this.errorId; + } + + /** + * Get if there is error in the table. + * + * @return the hasError value + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get name of the table. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get quoted name of the table. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTableColumn.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTableColumn.java new file mode 100644 index 0000000000000..37b1d799fc5be --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncFullSchemaTableColumn.java @@ -0,0 +1,122 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the column in the table of database full schema. + */ +public class SyncFullSchemaTableColumn { + /** + * Data size of the column. + */ + @JsonProperty(value = "dataSize", access = JsonProperty.Access.WRITE_ONLY) + private String dataSize; + + /** + * Data type of the column. + */ + @JsonProperty(value = "dataType", access = JsonProperty.Access.WRITE_ONLY) + private String dataType; + + /** + * Error id of the column. + */ + @JsonProperty(value = "errorId", access = JsonProperty.Access.WRITE_ONLY) + private String errorId; + + /** + * If there is error in the table. + */ + @JsonProperty(value = "hasError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasError; + + /** + * If it is the primary key of the table. + */ + @JsonProperty(value = "isPrimaryKey", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isPrimaryKey; + + /** + * Name of the column. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Quoted name of the column. + */ + @JsonProperty(value = "quotedName", access = JsonProperty.Access.WRITE_ONLY) + private String quotedName; + + /** + * Get data size of the column. + * + * @return the dataSize value + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Get data type of the column. + * + * @return the dataType value + */ + public String dataType() { + return this.dataType; + } + + /** + * Get error id of the column. + * + * @return the errorId value + */ + public String errorId() { + return this.errorId; + } + + /** + * Get if there is error in the table. + * + * @return the hasError value + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get if it is the primary key of the table. + * + * @return the isPrimaryKey value + */ + public Boolean isPrimaryKey() { + return this.isPrimaryKey; + } + + /** + * Get name of the column. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get quoted name of the column. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroup.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroup.java new file mode 100644 index 0000000000000..75e71abb9cdb2 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroup.java @@ -0,0 +1,246 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncGroupInner; +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.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing SyncGroup. + */ +public interface SyncGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the conflictResolutionPolicy value. + */ + SyncConflictResolutionPolicy conflictResolutionPolicy(); + + /** + * @return the hubDatabasePassword value. + */ + String hubDatabasePassword(); + + /** + * @return the hubDatabaseUserName value. + */ + String hubDatabaseUserName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the interval value. + */ + Integer interval(); + + /** + * @return the lastSyncTime value. + */ + DateTime lastSyncTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the schema value. + */ + SyncGroupSchema schema(); + + /** + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * @return the syncState value. + */ + SyncGroupState syncState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SyncGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of SyncGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SyncGroup definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the syncgroup definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the syncgroup definition allowing to specify ConflictResolutionPolicy. + */ + interface WithConflictResolutionPolicy { + /** + * Specifies conflictResolutionPolicy. + */ + WithCreate withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + + /** + * The stage of the syncgroup definition allowing to specify HubDatabasePassword. + */ + interface WithHubDatabasePassword { + /** + * Specifies hubDatabasePassword. + */ + WithCreate withHubDatabasePassword(String hubDatabasePassword); + } + + /** + * The stage of the syncgroup definition allowing to specify HubDatabaseUserName. + */ + interface WithHubDatabaseUserName { + /** + * Specifies hubDatabaseUserName. + */ + WithCreate withHubDatabaseUserName(String hubDatabaseUserName); + } + + /** + * The stage of the syncgroup definition allowing to specify Interval. + */ + interface WithInterval { + /** + * Specifies interval. + */ + WithCreate withInterval(Integer interval); + } + + /** + * The stage of the syncgroup definition allowing to specify Schema. + */ + interface WithSchema { + /** + * Specifies schema. + */ + WithCreate withSchema(SyncGroupSchema schema); + } + + /** + * The stage of the syncgroup definition allowing to specify SyncDatabaseId. + */ + interface WithSyncDatabaseId { + /** + * Specifies syncDatabaseId. + */ + WithCreate withSyncDatabaseId(String syncDatabaseId); + } + + /** + * 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.WithConflictResolutionPolicy, DefinitionStages.WithHubDatabasePassword, DefinitionStages.WithHubDatabaseUserName, DefinitionStages.WithInterval, DefinitionStages.WithSchema, DefinitionStages.WithSyncDatabaseId { + } + } + /** + * The template for a SyncGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithConflictResolutionPolicy, UpdateStages.WithHubDatabasePassword, UpdateStages.WithHubDatabaseUserName, UpdateStages.WithInterval, UpdateStages.WithSchema, UpdateStages.WithSyncDatabaseId { + } + + /** + * Grouping of SyncGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the syncgroup update allowing to specify ConflictResolutionPolicy. + */ + interface WithConflictResolutionPolicy { + /** + * Specifies conflictResolutionPolicy. + */ + Update withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + + /** + * The stage of the syncgroup update allowing to specify HubDatabasePassword. + */ + interface WithHubDatabasePassword { + /** + * Specifies hubDatabasePassword. + */ + Update withHubDatabasePassword(String hubDatabasePassword); + } + + /** + * The stage of the syncgroup update allowing to specify HubDatabaseUserName. + */ + interface WithHubDatabaseUserName { + /** + * Specifies hubDatabaseUserName. + */ + Update withHubDatabaseUserName(String hubDatabaseUserName); + } + + /** + * The stage of the syncgroup update allowing to specify Interval. + */ + interface WithInterval { + /** + * Specifies interval. + */ + Update withInterval(Integer interval); + } + + /** + * The stage of the syncgroup update allowing to specify Schema. + */ + interface WithSchema { + /** + * Specifies schema. + */ + Update withSchema(SyncGroupSchema schema); + } + + /** + * The stage of the syncgroup update allowing to specify SyncDatabaseId. + */ + interface WithSyncDatabaseId { + /** + * Specifies syncDatabaseId. + */ + Update withSyncDatabaseId(String syncDatabaseId); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupDatabasisServerSyncFullSchemaProperties.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupDatabasisServerSyncFullSchemaProperties.java new file mode 100644 index 0000000000000..0c6dfab5abb43 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupDatabasisServerSyncFullSchemaProperties.java @@ -0,0 +1,32 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncFullSchemaPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing SyncGroupDatabasisServerSyncFullSchemaProperties. + */ +public interface SyncGroupDatabasisServerSyncFullSchemaProperties extends HasInner, HasManager { + /** + * @return the lastUpdateTime value. + */ + DateTime lastUpdateTime(); + + /** + * @return the tables value. + */ + List tables(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogProperties.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogProperties.java new file mode 100644 index 0000000000000..f6b10fe8f36d9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogProperties.java @@ -0,0 +1,52 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncGroupLogPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing SyncGroupLogProperties. + */ +public interface SyncGroupLogProperties extends HasInner, HasManager { + /** + * @return the details value. + */ + String details(); + + /** + * @return the operationStatus value. + */ + String operationStatus(); + + /** + * @return the source value. + */ + String source(); + + /** + * @return the timestamp value. + */ + DateTime timestamp(); + + /** + * @return the tracingId value. + */ + UUID tracingId(); + + /** + * @return the type value. + */ + SyncGroupLogType type(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogType.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogType.java new file mode 100644 index 0000000000000..7005319eef95d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupLogType.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncGroupLogType. + */ +public final class SyncGroupLogType extends ExpandableStringEnum { + /** Static value All for SyncGroupLogType. */ + public static final SyncGroupLogType ALL = fromString("All"); + + /** Static value Error for SyncGroupLogType. */ + public static final SyncGroupLogType ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupLogType. */ + public static final SyncGroupLogType WARNING = fromString("Warning"); + + /** Static value Success for SyncGroupLogType. */ + public static final SyncGroupLogType SUCCESS = fromString("Success"); + + /** + * Creates or finds a SyncGroupLogType from its string representation. + * @param name a name to look for + * @return the corresponding SyncGroupLogType + */ + @JsonCreator + public static SyncGroupLogType fromString(String name) { + return fromString(name, SyncGroupLogType.class); + } + + /** + * @return known SyncGroupLogType values + */ + public static Collection values() { + return values(SyncGroupLogType.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchema.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchema.java new file mode 100644 index 0000000000000..e1d214f2f8884 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchema.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.v2015_05_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of sync group schema. + */ +public class SyncGroupSchema { + /** + * List of tables in sync group schema. + */ + @JsonProperty(value = "tables") + private List tables; + + /** + * Name of master sync member where the schema is from. + */ + @JsonProperty(value = "masterSyncMemberName") + private String masterSyncMemberName; + + /** + * Get list of tables in sync group schema. + * + * @return the tables value + */ + public List tables() { + return this.tables; + } + + /** + * Set list of tables in sync group schema. + * + * @param tables the tables value to set + * @return the SyncGroupSchema object itself. + */ + public SyncGroupSchema withTables(List tables) { + this.tables = tables; + return this; + } + + /** + * Get name of master sync member where the schema is from. + * + * @return the masterSyncMemberName value + */ + public String masterSyncMemberName() { + return this.masterSyncMemberName; + } + + /** + * Set name of master sync member where the schema is from. + * + * @param masterSyncMemberName the masterSyncMemberName value to set + * @return the SyncGroupSchema object itself. + */ + public SyncGroupSchema withMasterSyncMemberName(String masterSyncMemberName) { + this.masterSyncMemberName = masterSyncMemberName; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTable.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTable.java new file mode 100644 index 0000000000000..64435c7fec763 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTable.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.v2015_05_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of table in sync group schema. + */ +public class SyncGroupSchemaTable { + /** + * List of columns in sync group schema. + */ + @JsonProperty(value = "columns") + private List columns; + + /** + * Quoted name of sync group schema table. + */ + @JsonProperty(value = "quotedName") + private String quotedName; + + /** + * Get list of columns in sync group schema. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Set list of columns in sync group schema. + * + * @param columns the columns value to set + * @return the SyncGroupSchemaTable object itself. + */ + public SyncGroupSchemaTable withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get quoted name of sync group schema table. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set quoted name of sync group schema table. + * + * @param quotedName the quotedName value to set + * @return the SyncGroupSchemaTable object itself. + */ + public SyncGroupSchemaTable withQuotedName(String quotedName) { + this.quotedName = quotedName; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTableColumn.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTableColumn.java new file mode 100644 index 0000000000000..50d3903148ef5 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupSchemaTableColumn.java @@ -0,0 +1,95 @@ +/** + * 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.v2015_05_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of column in sync group table. + */ +public class SyncGroupSchemaTableColumn { + /** + * Quoted name of sync group table column. + */ + @JsonProperty(value = "quotedName") + private String quotedName; + + /** + * Data size of the column. + */ + @JsonProperty(value = "dataSize") + private String dataSize; + + /** + * Data type of the column. + */ + @JsonProperty(value = "dataType") + private String dataType; + + /** + * Get quoted name of sync group table column. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set quoted name of sync group table column. + * + * @param quotedName the quotedName value to set + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withQuotedName(String quotedName) { + this.quotedName = quotedName; + return this; + } + + /** + * Get data size of the column. + * + * @return the dataSize value + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Set data size of the column. + * + * @param dataSize the dataSize value to set + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withDataSize(String dataSize) { + this.dataSize = dataSize; + return this; + } + + /** + * Get data type of the column. + * + * @return the dataType value + */ + public String dataType() { + return this.dataType; + } + + /** + * Set data type of the column. + * + * @param dataType the dataType value to set + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withDataType(String dataType) { + this.dataType = dataType; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupState.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupState.java new file mode 100644 index 0000000000000..fc5e49502e4f9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroupState.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncGroupState. + */ +public final class SyncGroupState extends ExpandableStringEnum { + /** Static value NotReady for SyncGroupState. */ + public static final SyncGroupState NOT_READY = fromString("NotReady"); + + /** Static value Error for SyncGroupState. */ + public static final SyncGroupState ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupState. */ + public static final SyncGroupState WARNING = fromString("Warning"); + + /** Static value Progressing for SyncGroupState. */ + public static final SyncGroupState PROGRESSING = fromString("Progressing"); + + /** Static value Good for SyncGroupState. */ + public static final SyncGroupState GOOD = fromString("Good"); + + /** + * Creates or finds a SyncGroupState from its string representation. + * @param name a name to look for + * @return the corresponding SyncGroupState + */ + @JsonCreator + public static SyncGroupState fromString(String name) { + return fromString(name, SyncGroupState.class); + } + + /** + * @return known SyncGroupState values + */ + public static Collection values() { + return values(SyncGroupState.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroups.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroups.java new file mode 100644 index 0000000000000..7e8a3b43dc37d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncGroups.java @@ -0,0 +1,131 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncGroupsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncDatabaseIdProperties; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupLogProperties; + +/** + * Type representing SyncGroups. + */ +public interface SyncGroups extends SupportsCreating, HasInner { + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @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); + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSyncDatabaseIdsAsync(final String locationName); + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName); + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMember.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMember.java new file mode 100644 index 0000000000000..daacdc06ae652 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMember.java @@ -0,0 +1,291 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncMemberInner; +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.v2015_05_01_preview.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing SyncMember. + */ +public interface SyncMember extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the password value. + */ + String password(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the sqlServerDatabaseId value. + */ + UUID sqlServerDatabaseId(); + + /** + * @return the syncAgentId value. + */ + String syncAgentId(); + + /** + * @return the syncDirection value. + */ + SyncDirection syncDirection(); + + /** + * @return the syncState value. + */ + SyncMemberState syncState(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userName value. + */ + String userName(); + + /** + * The entirety of the SyncMember definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithSyncGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of SyncMember definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SyncMember definition. + */ + interface Blank extends WithSyncGroup { + } + + /** + * The stage of the syncmember definition allowing to specify SyncGroup. + */ + interface WithSyncGroup { + /** + * Specifies resourceGroupName, serverName, databaseName, syncGroupName. + */ + WithCreate withExistingSyncGroup(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + } + + /** + * The stage of the syncmember definition allowing to specify DatabaseName. + */ + interface WithDatabaseName { + /** + * Specifies databaseName. + */ + WithCreate withDatabaseName(String databaseName); + } + + /** + * The stage of the syncmember definition allowing to specify DatabaseType. + */ + interface WithDatabaseType { + /** + * Specifies databaseType. + */ + WithCreate withDatabaseType(SyncMemberDbType databaseType); + } + + /** + * The stage of the syncmember definition allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + */ + WithCreate withPassword(String password); + } + + /** + * The stage of the syncmember definition allowing to specify ServerName. + */ + interface WithServerName { + /** + * Specifies serverName. + */ + WithCreate withServerName(String serverName); + } + + /** + * The stage of the syncmember definition allowing to specify SqlServerDatabaseId. + */ + interface WithSqlServerDatabaseId { + /** + * Specifies sqlServerDatabaseId. + */ + WithCreate withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + + /** + * The stage of the syncmember definition allowing to specify SyncAgentId. + */ + interface WithSyncAgentId { + /** + * Specifies syncAgentId. + */ + WithCreate withSyncAgentId(String syncAgentId); + } + + /** + * The stage of the syncmember definition allowing to specify SyncDirection. + */ + interface WithSyncDirection { + /** + * Specifies syncDirection. + */ + WithCreate withSyncDirection(SyncDirection syncDirection); + } + + /** + * The stage of the syncmember definition allowing to specify UserName. + */ + interface WithUserName { + /** + * Specifies userName. + */ + WithCreate withUserName(String userName); + } + + /** + * 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.WithDatabaseName, DefinitionStages.WithDatabaseType, DefinitionStages.WithPassword, DefinitionStages.WithServerName, DefinitionStages.WithSqlServerDatabaseId, DefinitionStages.WithSyncAgentId, DefinitionStages.WithSyncDirection, DefinitionStages.WithUserName { + } + } + /** + * The template for a SyncMember update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDatabaseName, UpdateStages.WithDatabaseType, UpdateStages.WithPassword, UpdateStages.WithServerName, UpdateStages.WithSqlServerDatabaseId, UpdateStages.WithSyncAgentId, UpdateStages.WithSyncDirection, UpdateStages.WithUserName { + } + + /** + * Grouping of SyncMember update stages. + */ + interface UpdateStages { + /** + * The stage of the syncmember update allowing to specify DatabaseName. + */ + interface WithDatabaseName { + /** + * Specifies databaseName. + */ + Update withDatabaseName(String databaseName); + } + + /** + * The stage of the syncmember update allowing to specify DatabaseType. + */ + interface WithDatabaseType { + /** + * Specifies databaseType. + */ + Update withDatabaseType(SyncMemberDbType databaseType); + } + + /** + * The stage of the syncmember update allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + */ + Update withPassword(String password); + } + + /** + * The stage of the syncmember update allowing to specify ServerName. + */ + interface WithServerName { + /** + * Specifies serverName. + */ + Update withServerName(String serverName); + } + + /** + * The stage of the syncmember update allowing to specify SqlServerDatabaseId. + */ + interface WithSqlServerDatabaseId { + /** + * Specifies sqlServerDatabaseId. + */ + Update withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + + /** + * The stage of the syncmember update allowing to specify SyncAgentId. + */ + interface WithSyncAgentId { + /** + * Specifies syncAgentId. + */ + Update withSyncAgentId(String syncAgentId); + } + + /** + * The stage of the syncmember update allowing to specify SyncDirection. + */ + interface WithSyncDirection { + /** + * Specifies syncDirection. + */ + Update withSyncDirection(SyncDirection syncDirection); + } + + /** + * The stage of the syncmember update allowing to specify UserName. + */ + interface WithUserName { + /** + * Specifies userName. + */ + Update withUserName(String userName); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberDbType.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberDbType.java new file mode 100644 index 0000000000000..befdc72681166 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberDbType.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncMemberDbType. + */ +public final class SyncMemberDbType extends ExpandableStringEnum { + /** Static value AzureSqlDatabase for SyncMemberDbType. */ + public static final SyncMemberDbType AZURE_SQL_DATABASE = fromString("AzureSqlDatabase"); + + /** Static value SqlServerDatabase for SyncMemberDbType. */ + public static final SyncMemberDbType SQL_SERVER_DATABASE = fromString("SqlServerDatabase"); + + /** + * Creates or finds a SyncMemberDbType from its string representation. + * @param name a name to look for + * @return the corresponding SyncMemberDbType + */ + @JsonCreator + public static SyncMemberDbType fromString(String name) { + return fromString(name, SyncMemberDbType.class); + } + + /** + * @return known SyncMemberDbType values + */ + public static Collection values() { + return values(SyncMemberDbType.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberState.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberState.java new file mode 100644 index 0000000000000..4e745e0f85b2b --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberState.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncMemberState. + */ +public final class SyncMemberState extends ExpandableStringEnum { + /** Static value SyncInProgress for SyncMemberState. */ + public static final SyncMemberState SYNC_IN_PROGRESS = fromString("SyncInProgress"); + + /** Static value SyncSucceeded for SyncMemberState. */ + public static final SyncMemberState SYNC_SUCCEEDED = fromString("SyncSucceeded"); + + /** Static value SyncFailed for SyncMemberState. */ + public static final SyncMemberState SYNC_FAILED = fromString("SyncFailed"); + + /** Static value DisabledTombstoneCleanup for SyncMemberState. */ + public static final SyncMemberState DISABLED_TOMBSTONE_CLEANUP = fromString("DisabledTombstoneCleanup"); + + /** Static value DisabledBackupRestore for SyncMemberState. */ + public static final SyncMemberState DISABLED_BACKUP_RESTORE = fromString("DisabledBackupRestore"); + + /** Static value SyncSucceededWithWarnings for SyncMemberState. */ + public static final SyncMemberState SYNC_SUCCEEDED_WITH_WARNINGS = fromString("SyncSucceededWithWarnings"); + + /** Static value SyncCancelling for SyncMemberState. */ + public static final SyncMemberState SYNC_CANCELLING = fromString("SyncCancelling"); + + /** Static value SyncCancelled for SyncMemberState. */ + public static final SyncMemberState SYNC_CANCELLED = fromString("SyncCancelled"); + + /** Static value UnProvisioned for SyncMemberState. */ + public static final SyncMemberState UN_PROVISIONED = fromString("UnProvisioned"); + + /** Static value Provisioning for SyncMemberState. */ + public static final SyncMemberState PROVISIONING = fromString("Provisioning"); + + /** Static value Provisioned for SyncMemberState. */ + public static final SyncMemberState PROVISIONED = fromString("Provisioned"); + + /** Static value ProvisionFailed for SyncMemberState. */ + public static final SyncMemberState PROVISION_FAILED = fromString("ProvisionFailed"); + + /** Static value DeProvisioning for SyncMemberState. */ + public static final SyncMemberState DE_PROVISIONING = fromString("DeProvisioning"); + + /** Static value DeProvisioned for SyncMemberState. */ + public static final SyncMemberState DE_PROVISIONED = fromString("DeProvisioned"); + + /** Static value DeProvisionFailed for SyncMemberState. */ + public static final SyncMemberState DE_PROVISION_FAILED = fromString("DeProvisionFailed"); + + /** Static value Reprovisioning for SyncMemberState. */ + public static final SyncMemberState REPROVISIONING = fromString("Reprovisioning"); + + /** Static value ReprovisionFailed for SyncMemberState. */ + public static final SyncMemberState REPROVISION_FAILED = fromString("ReprovisionFailed"); + + /** Static value UnReprovisioned for SyncMemberState. */ + public static final SyncMemberState UN_REPROVISIONED = fromString("UnReprovisioned"); + + /** + * Creates or finds a SyncMemberState from its string representation. + * @param name a name to look for + * @return the corresponding SyncMemberState + */ + @JsonCreator + public static SyncMemberState fromString(String name) { + return fromString(name, SyncMemberState.class); + } + + /** + * @return known SyncMemberState values + */ + public static Collection values() { + return values(SyncMemberState.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java new file mode 100644 index 0000000000000..7f0a51982b752 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java @@ -0,0 +1,32 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncFullSchemaPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties. + */ +public interface SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties extends HasInner, HasManager { + /** + * @return the lastUpdateTime value. + */ + DateTime lastUpdateTime(); + + /** + * @return the tables value. + */ + List tables(); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMembers.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMembers.java new file mode 100644 index 0000000000000..e7b171941e5c9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/SyncMembers.java @@ -0,0 +1,86 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SyncMembersInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties; + +/** + * Type representing SyncMembers. + */ +public interface SyncMembers extends SupportsCreating, HasInner { + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRule.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRule.java new file mode 100644 index 0000000000000..8a09bf37b9ae9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRule.java @@ -0,0 +1,130 @@ +/** + * 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.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.VirtualNetworkRuleInner; +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.v2015_05_01_preview.implementation.SqlManager; + +/** + * Type representing VirtualNetworkRule. + */ +public interface VirtualNetworkRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the ignoreMissingVnetServiceEndpoint value. + */ + Boolean ignoreMissingVnetServiceEndpoint(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + VirtualNetworkRuleState state(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * The entirety of the VirtualNetworkRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithVirtualNetworkSubnetId, DefinitionStages.WithCreate { + } + + /** + * Grouping of VirtualNetworkRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a VirtualNetworkRule definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the virtualnetworkrule definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithVirtualNetworkSubnetId withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the virtualnetworkrule definition allowing to specify VirtualNetworkSubnetId. + */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies virtualNetworkSubnetId. + */ + WithCreate withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + + /** + * The stage of the virtualnetworkrule definition allowing to specify IgnoreMissingVnetServiceEndpoint. + */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies ignoreMissingVnetServiceEndpoint. + */ + WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + + /** + * 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.WithIgnoreMissingVnetServiceEndpoint { + } + } + /** + * The template for a VirtualNetworkRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIgnoreMissingVnetServiceEndpoint { + } + + /** + * Grouping of VirtualNetworkRule update stages. + */ + interface UpdateStages { + /** + * The stage of the virtualnetworkrule update allowing to specify IgnoreMissingVnetServiceEndpoint. + */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies ignoreMissingVnetServiceEndpoint. + */ + Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRuleState.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRuleState.java new file mode 100644 index 0000000000000..251ec8eaa0b3a --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRuleState.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.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VirtualNetworkRuleState. + */ +public final class VirtualNetworkRuleState extends ExpandableStringEnum { + /** Static value Initializing for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); + + /** Static value InProgress for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); + + /** Static value Ready for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState READY = fromString("Ready"); + + /** Static value Deleting for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); + + /** Static value Unknown for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a VirtualNetworkRuleState from its string representation. + * @param name a name to look for + * @return the corresponding VirtualNetworkRuleState + */ + @JsonCreator + public static VirtualNetworkRuleState fromString(String name) { + return fromString(name, VirtualNetworkRuleState.class); + } + + /** + * @return known VirtualNetworkRuleState values + */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRules.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRules.java new file mode 100644 index 0000000000000..ec0498227b7f2 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualNetworkRules.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.v2015_05_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.VirtualNetworkRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualNetworkRules. + */ +public interface VirtualNetworkRules extends SupportsCreating, HasInner { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a list of virtual network rules in 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 the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName); + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java new file mode 100644 index 0000000000000..2663f03294610 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java @@ -0,0 +1,170 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.AdvisorStatus; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatus; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatusInheritedFrom; +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; + +/** + * Database, Server or Elatic Pool Advisor. + */ +@JsonFlatten +public class AdvisorInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Gets the status of availability of this advisor to customers. Possible + * values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and + * 'PrivatePreview'. Possible values include: 'GA', 'PublicPreview', + * 'LimitedPublicPreview', 'PrivatePreview'. + */ + @JsonProperty(value = "properties.advisorStatus", access = JsonProperty.Access.WRITE_ONLY) + private AdvisorStatus advisorStatus; + + /** + * Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and + * 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default'. + */ + @JsonProperty(value = "properties.autoExecuteStatus", required = true) + private AutoExecuteStatus autoExecuteStatus; + + /** + * Gets the resource from which current value of auto-execute status is + * inherited. Auto-execute status can be set on (and inhertied from) + * different levels in the resource heirarchy. Possible values are + * 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when + * status is not explicitly set on any level). Possible values include: + * 'Default', 'Subscription', 'Server', 'ElasticPool', 'Database'. + */ + @JsonProperty(value = "properties.autoExecuteStatusInheritedFrom", access = JsonProperty.Access.WRITE_ONLY) + private AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom; + + /** + * Gets that status of recommendations for this advisor and reason for not + * having any recommendations. Possible values include, but are not limited + * to, 'Ok' (Recommendations available),LowActivity (not enough workload to + * analyze), 'DbSeemsTuned' (Database is doing well), etc. + */ + @JsonProperty(value = "properties.recommendationsStatus", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationsStatus; + + /** + * Gets the time when the current resource was analyzed for recommendations + * by this advisor. + */ + @JsonProperty(value = "properties.lastChecked", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastChecked; + + /** + * Gets the recommended actions for this advisor. + */ + @JsonProperty(value = "properties.recommendedActions", access = JsonProperty.Access.WRITE_ONLY) + private List recommendedActions; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. Possible values include: 'GA', 'PublicPreview', 'LimitedPublicPreview', 'PrivatePreview'. + * + * @return the advisorStatus value + */ + public AdvisorStatus advisorStatus() { + return this.advisorStatus; + } + + /** + * Get gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default'. + * + * @return the autoExecuteStatus value + */ + public AutoExecuteStatus autoExecuteStatus() { + return this.autoExecuteStatus; + } + + /** + * Set gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default'. + * + * @param autoExecuteStatus the autoExecuteStatus value to set + * @return the AdvisorInner object itself. + */ + public AdvisorInner withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { + this.autoExecuteStatus = autoExecuteStatus; + return this; + } + + /** + * Get gets the resource from which current value of auto-execute status is inherited. Auto-execute status can be set on (and inhertied from) different levels in the resource heirarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). Possible values include: 'Default', 'Subscription', 'Server', 'ElasticPool', 'Database'. + * + * @return the autoExecuteStatusInheritedFrom value + */ + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.autoExecuteStatusInheritedFrom; + } + + /** + * Get gets that status of recommendations for this advisor and reason for not having any recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations available),LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc. + * + * @return the recommendationsStatus value + */ + public String recommendationsStatus() { + return this.recommendationsStatus; + } + + /** + * Get gets the time when the current resource was analyzed for recommendations by this advisor. + * + * @return the lastChecked value + */ + public DateTime lastChecked() { + return this.lastChecked; + } + + /** + * Get gets the recommended actions for this advisor. + * + * @return the recommendedActions value + */ + public List recommendedActions() { + return this.recommendedActions; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.java new file mode 100644 index 0000000000000..03cb4d7448478 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAdvisors; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabasisServerAdvisor; + +class DatabaseAdvisorsImpl extends WrapperImpl implements DatabaseAdvisors { + private final SqlManager manager; + + DatabaseAdvisorsImpl(SqlManager manager) { + super(manager.inner().databaseAdvisors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabasisServerAdvisorImpl wrapModel(AdvisorInner inner) { + return new DatabasisServerAdvisorImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseAdvisorsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisServerAdvisor call(AdvisorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + DatabaseAdvisorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, advisorName) + .map(new Func1() { + @Override + public DatabasisServerAdvisor call(AdvisorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsInner.java new file mode 100644 index 0000000000000..3ff14eb297313 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsInner.java @@ -0,0 +1,374 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatus; +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.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 DatabaseAdvisors. + */ +public class DatabaseAdvisorsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseAdvisorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAdvisorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseAdvisorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseAdvisorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseAdvisors to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseAdvisorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAdvisors listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors") + 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.v2015_05_01_preview.DatabaseAdvisors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("advisorName") String advisorName, @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.v2015_05_01_preview.DatabaseAdvisors update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("advisorName") String advisorName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AdvisorInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The 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. + * @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 List<AdvisorInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<AdvisorInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<AdvisorInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(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."); + } + 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> clientResponse = listByDatabaseDelegate(response); + return Observable.just(clientResponse); + } 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 advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @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 AdvisorInner object if successful. + */ + public AdvisorInner get(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).toBlocking().single().body(); + } + + /** + * Gets a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @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, String advisorName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName), serviceCallback); + } + + /** + * Gets a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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, databaseName, advisorName, 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); + } + + /** + * Updates a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 AdvisorInner object if successful. + */ + public AdvisorInner update(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteStatus) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteStatus).toBlocking().single().body(); + } + + /** + * Updates a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteStatus, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteStatus), serviceCallback); + } + + /** + * Updates a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteStatus) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteStatus).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database advisor. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteStatus) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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 (autoExecuteStatus == null) { + throw new IllegalArgumentException("Parameter autoExecuteStatus is required and cannot be null."); + } + AdvisorInner parameters = new AdvisorInner(); + parameters.withAutoExecuteStatus(autoExecuteStatus); + return service.update(resourceGroupName, serverName, databaseName, advisorName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningImpl.java new file mode 100644 index 0000000000000..52454ecbbfc24 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningImpl.java @@ -0,0 +1,59 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAutomaticTuning; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutomaticTuningMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutomaticTuningOptions; + +class DatabaseAutomaticTuningImpl extends WrapperImpl implements DatabaseAutomaticTuning { + private final SqlManager manager; + DatabaseAutomaticTuningImpl(DatabaseAutomaticTuningInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public AutomaticTuningMode actualState() { + return this.inner().actualState(); + } + + @Override + public AutomaticTuningMode desiredState() { + return this.inner().desiredState(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map options() { + return this.inner().options(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningInner.java new file mode 100644 index 0000000000000..0ed7b8823f134 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningInner.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutomaticTuningMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutomaticTuningOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Database-level Automatic Tuning. + */ +@JsonFlatten +public class DatabaseAutomaticTuningInner extends ProxyResource { + /** + * Automatic tuning desired state. Possible values include: 'Inherit', + * 'Custom', 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.desiredState") + private AutomaticTuningMode desiredState; + + /** + * Automatic tuning actual state. Possible values include: 'Inherit', + * 'Custom', 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningMode actualState; + + /** + * Automatic tuning options definition. + */ + @JsonProperty(value = "properties.options") + private Map options; + + /** + * Get automatic tuning desired state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified'. + * + * @return the desiredState value + */ + public AutomaticTuningMode desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning desired state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified'. + * + * @param desiredState the desiredState value to set + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withDesiredState(AutomaticTuningMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning actual state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified'. + * + * @return the actualState value + */ + public AutomaticTuningMode actualState() { + return this.actualState; + } + + /** + * Get automatic tuning options definition. + * + * @return the options value + */ + public Map options() { + return this.options; + } + + /** + * Set automatic tuning options definition. + * + * @param options the options value to set + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withOptions(Map options) { + this.options = options; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..9fbc2840d3ca6 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAutomaticTunings; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAutomaticTuning; + +class DatabaseAutomaticTuningsImpl extends WrapperImpl implements DatabaseAutomaticTunings { + private final SqlManager manager; + + DatabaseAutomaticTuningsImpl(SqlManager manager) { + super(manager.inner().databaseAutomaticTunings()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseAutomaticTuningsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseAutomaticTuning call(DatabaseAutomaticTuningInner inner) { + return new DatabaseAutomaticTuningImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + DatabaseAutomaticTuningsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serverName, databaseName, parameters) + .map(new Func1() { + @Override + public DatabaseAutomaticTuning call(DatabaseAutomaticTuningInner inner) { + return new DatabaseAutomaticTuningImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsInner.java new file mode 100644 index 0000000000000..e21ed05705296 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsInner.java @@ -0,0 +1,261 @@ +/** + * 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.v2015_05_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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 DatabaseAutomaticTunings. + */ +public class DatabaseAutomaticTuningsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseAutomaticTuningsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAutomaticTuningsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseAutomaticTuningsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseAutomaticTuningsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseAutomaticTunings to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseAutomaticTuningsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAutomaticTunings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current") + Observable> get(@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.v2015_05_01_preview.DatabaseAutomaticTunings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseAutomaticTuningInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @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 DatabaseAutomaticTuningInner object if successful. + */ + public DatabaseAutomaticTuningInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @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 automatic tuning. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseAutomaticTuningInner>() { + @Override + public DatabaseAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner 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."); + } + return service.get(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 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); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning 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 DatabaseAutomaticTuningInner object if successful. + */ + public DatabaseAutomaticTuningInner update(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning 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 serverName, String databaseName, DatabaseAutomaticTuningInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseAutomaticTuningInner>() { + @Override + public DatabaseAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner 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); + return service.update(resourceGroupName, serverName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..c55dc580dd4e1 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicy; + +class DatabaseBlobAuditingPoliciesImpl extends WrapperImpl implements DatabaseBlobAuditingPolicies { + private final SqlManager manager; + + DatabaseBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private DatabaseBlobAuditingPolicyImpl wrapModel(DatabaseBlobAuditingPolicyInner inner) { + return new DatabaseBlobAuditingPolicyImpl(inner, manager()); + } + + private DatabaseBlobAuditingPolicyImpl wrapModel(String name) { + return new DatabaseBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseBlobAuditingPolicy call(DatabaseBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..9eefab8c2b2a6 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v2015_05_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseBlobAuditingPolicies. + */ +public class DatabaseBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v2015_05_01_preview.DatabaseBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body DatabaseBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's blob auditing 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. + * @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 DatabaseBlobAuditingPolicyInner object if successful. + */ + public DatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's blob auditing 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. + * @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 blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseBlobAuditingPolicyInner>() { + @Override + public DatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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 blob auditing 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. + * @param parameters The database blob auditing 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 DatabaseBlobAuditingPolicyInner object if successful. + */ + public DatabaseBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing 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, DatabaseBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseBlobAuditingPolicyInner>() { + @Override + public DatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..502ce426793a4 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,191 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class DatabaseBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements DatabaseBlobAuditingPolicy, DatabaseBlobAuditingPolicy.Definition, DatabaseBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new DatabaseBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseBlobAuditingPolicyImpl(DatabaseBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseBlobAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..509ea501d2209 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,443 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database blob auditing policy. + */ +@JsonFlatten +public class DatabaseBlobAuditingPolicyInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.java new file mode 100644 index 0000000000000..97fa152417e0d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseRecommendedActions; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedAction; + +class DatabaseRecommendedActionsImpl extends WrapperImpl implements DatabaseRecommendedActions { + private final SqlManager manager; + + DatabaseRecommendedActionsImpl(SqlManager manager) { + super(manager.inner().databaseRecommendedActions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RecommendedActionImpl wrapModel(RecommendedActionInner inner) { + return new RecommendedActionImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + DatabaseRecommendedActionsInner client = this.inner(); + return client.listByDatabaseAdvisorAsync(resourceGroupName, serverName, databaseName, advisorName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecommendedAction call(RecommendedActionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName) { + DatabaseRecommendedActionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName) + .map(new Func1() { + @Override + public RecommendedAction call(RecommendedActionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java new file mode 100644 index 0000000000000..9091dd69ade9f --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java @@ -0,0 +1,397 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionStateInfo; +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.PATCH; +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 DatabaseRecommendedActions. + */ +public class DatabaseRecommendedActionsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseRecommendedActionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseRecommendedActionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseRecommendedActionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseRecommendedActionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseRecommendedActions to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseRecommendedActionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseRecommendedActions listByDatabaseAdvisor" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions") + Observable> listByDatabaseAdvisor(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("advisorName") String advisorName, @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.v2015_05_01_preview.DatabaseRecommendedActions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("advisorName") String advisorName, @Path("recommendedActionName") String recommendedActionName, @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.v2015_05_01_preview.DatabaseRecommendedActions update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("advisorName") String advisorName, @Path("recommendedActionName") String recommendedActionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RecommendedActionInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @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 List<RecommendedActionInner> object if successful. + */ + public List listByDatabaseAdvisor(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return listByDatabaseAdvisorWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).toBlocking().single().body(); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @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> listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseAdvisorWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName), serviceCallback); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedActionInner> object + */ + public Observable> listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return listByDatabaseAdvisorWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedActionInner> object + */ + public Observable>> listByDatabaseAdvisorWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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.listByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName, 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 = listByDatabaseAdvisorDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseAdvisorDelegate(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 recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @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 RecommendedActionInner object if successful. + */ + public RecommendedActionInner get(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName).toBlocking().single().body(); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @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, String advisorName, String recommendedActionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName), serviceCallback); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedActionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName).map(new Func1, RecommendedActionInner>() { + @Override + public RecommendedActionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedActionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName is required and cannot be null."); + } + if (recommendedActionName == null) { + throw new IllegalArgumentException("Parameter recommendedActionName 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, databaseName, advisorName, recommendedActionName, 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); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param state Gets the info of the current state the recommended action is in. + * @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 RecommendedActionInner object if successful. + */ + public RecommendedActionInner update(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName, RecommendedActionStateInfo state) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, state).toBlocking().single().body(); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param state Gets the info of the current state the recommended action is in. + * @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 serverName, String databaseName, String advisorName, String recommendedActionName, RecommendedActionStateInfo state, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, state), serviceCallback); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param state Gets the info of the current state the recommended action is in. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedActionInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName, RecommendedActionStateInfo state) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, state).map(new Func1, RecommendedActionInner>() { + @Override + public RecommendedActionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The 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. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param state Gets the info of the current state the recommended action is in. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedActionInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName, RecommendedActionStateInfo state) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName is required and cannot be null."); + } + if (recommendedActionName == null) { + throw new IllegalArgumentException("Parameter recommendedActionName 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 (state == null) { + throw new IllegalArgumentException("Parameter state is required and cannot be null."); + } + Validator.validate(state); + RecommendedActionInner parameters = new RecommendedActionInner(); + parameters.withState(state); + return service.update(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabasisServerAdvisorImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabasisServerAdvisorImpl.java new file mode 100644 index 0000000000000..eb7b8e4b3d963 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabasisServerAdvisorImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabasisServerAdvisor; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatus; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AdvisorStatus; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatusInheritedFrom; +import org.joda.time.DateTime; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedAction; +import java.util.List; + +class DatabasisServerAdvisorImpl extends CreatableUpdatableImpl implements DatabasisServerAdvisor, DatabasisServerAdvisor.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String advisorName; + private AutoExecuteStatus uautoExecuteStatus; + + DatabasisServerAdvisorImpl(String name, SqlManager manager) { + super(name, new AdvisorInner()); + this.manager = manager; + // Set resource name + this.advisorName = name; + // + } + + DatabasisServerAdvisorImpl(AdvisorInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.advisorName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.advisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "advisors"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabaseAdvisorsInner client = this.manager().inner().databaseAdvisors(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + DatabaseAdvisorsInner client = this.manager().inner().databaseAdvisors(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.advisorName, this.uautoExecuteStatus) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseAdvisorsInner client = this.manager().inner().databaseAdvisors(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.advisorName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AdvisorStatus advisorStatus() { + return this.inner().advisorStatus(); + } + + @Override + public AutoExecuteStatus autoExecuteStatus() { + return this.inner().autoExecuteStatus(); + } + + @Override + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.inner().autoExecuteStatusInheritedFrom(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DateTime lastChecked() { + return this.inner().lastChecked(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recommendationsStatus() { + return this.inner().recommendationsStatus(); + } + + @Override + public List recommendedActions() { + List lst = new ArrayList(); + if (this.inner().recommendedActions() != null) { + for (RecommendedActionInner inner : this.inner().recommendedActions()) { + lst.add( new RecommendedActionImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabasisServerAdvisorImpl withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { + this.uautoExecuteStatus = autoExecuteStatus; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorImpl.java new file mode 100644 index 0000000000000..5cdde1a87ea25 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorImpl.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. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtector; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKeyType; + +class EncryptionProtectorImpl extends WrapperImpl implements EncryptionProtector { + private final SqlManager manager; + EncryptionProtectorImpl(EncryptionProtectorInner 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 kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serverKeyName() { + return this.inner().serverKeyName(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String subregion() { + return this.inner().subregion(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java new file mode 100644 index 0000000000000..34583678617e8 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java @@ -0,0 +1,161 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The server encryption protector. + */ +@JsonFlatten +public class EncryptionProtectorInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Subregion of the encryption protector. + */ + @JsonProperty(value = "properties.subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /** + * The name of the server key. + */ + @JsonProperty(value = "properties.serverKeyName") + private String serverKeyName; + + /** + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * Possible values include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Set kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @param kind the kind value to set + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get subregion of the encryption protector. + * + * @return the subregion value + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the name of the server key. + * + * @return the serverKeyName value + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the name of the server key. + * + * @param serverKeyName the serverKeyName value to set + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the server key. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get thumbprint of the server key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..f181d760e89a5 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java @@ -0,0 +1,73 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtectors; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtector; + +class EncryptionProtectorsImpl extends WrapperImpl implements EncryptionProtectors { + private final SqlManager manager; + + EncryptionProtectorsImpl(SqlManager manager) { + super(manager.inner().encryptionProtectors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + EncryptionProtectorsInner 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 EncryptionProtector call(EncryptionProtectorInner inner) { + return new EncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + EncryptionProtectorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public EncryptionProtector call(EncryptionProtectorInner inner) { + return new EncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + EncryptionProtectorsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serverName, parameters) + .map(new Func1() { + @Override + public EncryptionProtector call(EncryptionProtectorInner inner) { + return new EncryptionProtectorImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java new file mode 100644 index 0000000000000..c0e1a31691d13 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java @@ -0,0 +1,580 @@ +/** + * 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.v2015_05_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 EncryptionProtectors. + */ +public class EncryptionProtectorsInner { + /** The Retrofit service to perform REST calls. */ + private EncryptionProtectorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of EncryptionProtectorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EncryptionProtectorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(EncryptionProtectorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EncryptionProtectors to be + * used by Retrofit to perform actually REST calls. + */ + interface EncryptionProtectorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtectors listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector") + 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.v2015_05_01_preview.EncryptionProtectors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @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.v2015_05_01_preview.EncryptionProtectors createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body EncryptionProtectorInner 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.v2015_05_01_preview.EncryptionProtectors beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body EncryptionProtectorInner 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.v2015_05_01_preview.EncryptionProtectors listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The 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<EncryptionProtectorInner> 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 encryption protectors. + * + * @param resourceGroupName The 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 encryption protectors. + * + * @param resourceGroupName The 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<EncryptionProtectorInner> 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 encryption protectors. + * + * @param resourceGroupName The 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<EncryptionProtectorInner> 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 encryption protectors. + * + 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<EncryptionProtectorInner> 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 a server encryption protector. + * + * @param resourceGroupName The 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 EncryptionProtectorInner object if successful. + */ + public EncryptionProtectorInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The 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 encryption protector. + * + * @param resourceGroupName The 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 EncryptionProtectorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, EncryptionProtectorInner>() { + @Override + public EncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The 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 EncryptionProtectorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String encryptionProtectorName = "current"; + return service.get(resourceGroupName, serverName, encryptionProtectorName, 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); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 EncryptionProtectorInner object if successful. + */ + public EncryptionProtectorInner createOrUpdate(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 serverName, EncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, EncryptionProtectorInner>() { + @Override + public EncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, EncryptionProtectorInner 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 (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 encryptionProtectorName = "current"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, encryptionProtectorName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 EncryptionProtectorInner object if successful. + */ + public EncryptionProtectorInner beginCreateOrUpdate(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 serverName, EncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EncryptionProtectorInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, EncryptionProtectorInner>() { + @Override + public EncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EncryptionProtectorInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, EncryptionProtectorInner 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 (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 encryptionProtectorName = "current"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, encryptionProtectorName, 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 list of server encryption protectors. + * + * @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<EncryptionProtectorInner> 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 encryption protectors. + * + * @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 encryption protectors. + * + * @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<EncryptionProtectorInner> 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 encryption protectors. + * + * @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<EncryptionProtectorInner> 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 encryption protectors. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EncryptionProtectorInner> 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupImpl.java new file mode 100644 index 0000000000000..2c75997050fa9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupImpl.java @@ -0,0 +1,208 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroupUpdate; +import java.util.List; +import java.util.Map; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroupReplicationRole; +import com.microsoft.azure.management.sql.v2015_05_01_preview.PartnerInfo; +import rx.functions.Func1; + +class FailoverGroupImpl extends CreatableUpdatableImpl implements FailoverGroup, FailoverGroup.Definition, FailoverGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String failoverGroupName; + private FailoverGroupUpdate updateParameter; + + FailoverGroupImpl(String name, SqlManager manager) { + super(name, new FailoverGroupInner()); + this.manager = manager; + // Set resource name + this.failoverGroupName = name; + // + this.updateParameter = new FailoverGroupUpdate(); + } + + FailoverGroupImpl(FailoverGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.failoverGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.failoverGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "failoverGroups"); + // + this.updateParameter = new FailoverGroupUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FailoverGroupsInner client = this.manager().inner().failoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.failoverGroupName, this.inner()) + .map(new Func1() { + @Override + public FailoverGroupInner call(FailoverGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FailoverGroupsInner client = this.manager().inner().failoverGroups(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.failoverGroupName, this.updateParameter) + .map(new Func1() { + @Override + public FailoverGroupInner call(FailoverGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FailoverGroupsInner client = this.manager().inner().failoverGroups(); + return client.getAsync(this.resourceGroupName, this.serverName, this.failoverGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new FailoverGroupUpdate(); + } + + @Override + public List databases() { + return this.inner().databases(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List partnerServers() { + return this.inner().partnerServers(); + } + + @Override + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.inner().readOnlyEndpoint(); + } + + @Override + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.inner().readWriteEndpoint(); + } + + @Override + public FailoverGroupReplicationRole replicationRole() { + return this.inner().replicationRole(); + } + + @Override + public String replicationState() { + return this.inner().replicationState(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FailoverGroupImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public FailoverGroupImpl withPartnerServers(List partnerServers) { + this.inner().withPartnerServers(partnerServers); + return this; + } + + @Override + public FailoverGroupImpl withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + if (isInCreateMode()) { + this.inner().withReadWriteEndpoint(readWriteEndpoint); + } else { + this.updateParameter.withReadWriteEndpoint(readWriteEndpoint); + } + return this; + } + + @Override + public FailoverGroupImpl withDatabases(List databases) { + if (isInCreateMode()) { + this.inner().withDatabases(databases); + } else { + this.updateParameter.withDatabases(databases); + } + return this; + } + + @Override + public FailoverGroupImpl withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + if (isInCreateMode()) { + this.inner().withReadOnlyEndpoint(readOnlyEndpoint); + } else { + this.updateParameter.withReadOnlyEndpoint(readOnlyEndpoint); + } + return this; + } + + @Override + public FailoverGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupInner.java new file mode 100644 index 0000000000000..9165e45a61e22 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupInner.java @@ -0,0 +1,202 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.PartnerInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A failover group. + */ +@JsonFlatten +public class FailoverGroupInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint", required = true) + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * Local replication role of the failover group instance. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /** + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /** + * List of partner server information for the failover group. + */ + @JsonProperty(value = "properties.partnerServers", required = true) + private List partnerServers; + + /** + * List of databases in the failover group. + */ + @JsonProperty(value = "properties.databases") + private List databases; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * 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 FailoverGroupInner object itself. + */ + public FailoverGroupInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get replication state of the failover group instance. + * + * @return the replicationState value + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get list of partner server information for the failover group. + * + * @return the partnerServers value + */ + public List partnerServers() { + return this.partnerServers; + } + + /** + * Set list of partner server information for the failover group. + * + * @param partnerServers the partnerServers value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withPartnerServers(List partnerServers) { + this.partnerServers = partnerServers; + return this; + } + + /** + * Get list of databases in the failover group. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Set list of databases in the failover group. + * + * @param databases the databases value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withDatabases(List databases) { + this.databases = databases; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java new file mode 100644 index 0000000000000..72a96b03d6895 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java @@ -0,0 +1,105 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroup; + +class FailoverGroupsImpl extends WrapperImpl implements FailoverGroups { + private final SqlManager manager; + + FailoverGroupsImpl(SqlManager manager) { + super(manager.inner().failoverGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public FailoverGroupImpl define(String name) { + return wrapModel(name); + } + + private FailoverGroupImpl wrapModel(FailoverGroupInner inner) { + return new FailoverGroupImpl(inner, manager()); + } + + private FailoverGroupImpl wrapModel(String name) { + return new FailoverGroupImpl(name, this.manager()); + } + + @Override + public Observable failoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, failoverGroupName) + .map(new Func1() { + @Override + public FailoverGroup call(FailoverGroupInner inner) { + return new FailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.forceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName) + .map(new Func1() { + @Override + public FailoverGroup call(FailoverGroupInner inner) { + return new FailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + FailoverGroupsInner 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 FailoverGroup call(FailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, failoverGroupName) + .map(new Func1() { + @Override + public FailoverGroup call(FailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, failoverGroupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java new file mode 100644 index 0000000000000..85dfccde80bf9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java @@ -0,0 +1,1330 @@ +/** + * 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.v2015_05_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.v2015_05_01_preview.FailoverGroupUpdate; +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 FailoverGroups. + */ +public class FailoverGroupsInner { + /** The Retrofit service to perform REST calls. */ + private FailoverGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of FailoverGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FailoverGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(FailoverGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for FailoverGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface FailoverGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v2015_05_01_preview.FailoverGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupInner 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.v2015_05_01_preview.FailoverGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupInner 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.v2015_05_01_preview.FailoverGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v2015_05_01_preview.FailoverGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v2015_05_01_preview.FailoverGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdate 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.v2015_05_01_preview.FailoverGroups beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdate 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.v2015_05_01_preview.FailoverGroups listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups") + 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.v2015_05_01_preview.FailoverGroups failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v2015_05_01_preview.FailoverGroups beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v2015_05_01_preview.FailoverGroups forceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> forceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v2015_05_01_preview.FailoverGroups beginForceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> beginForceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v2015_05_01_preview.FailoverGroups listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner get(String resourceGroupName, String serverName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner createOrUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 failoverGroupName, FailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 failoverGroupName, FailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner update(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 serverName, String failoverGroupName, FailoverGroupUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, serverName, failoverGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 serverName, String failoverGroupName, FailoverGroupUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, serverName, failoverGroupName, 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); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @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<FailoverGroupInner> 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(); + } + }; + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @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); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FailoverGroupInner> 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(); + } + }); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FailoverGroupInner> 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)); + } + }); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FailoverGroupInner> 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); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginFailover(String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> forceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 beginForceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginForceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginForceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.beginForceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, 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 = beginForceFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginForceFailoverAllowDataLossDelegate(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 the failover groups in 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<FailoverGroupInner> 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(); + } + }; + } + + /** + * Lists the failover groups in 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); + } + + /** + * Lists the failover groups in 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<FailoverGroupInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in 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<FailoverGroupInner> 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)); + } + }); + } + + /** + * Lists the failover groups in 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<FailoverGroupInner> 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..b979d1f220ffc --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleImpl.java @@ -0,0 +1,116 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.FirewallRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class FirewallRuleImpl extends CreatableUpdatableImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String firewallRuleName; + + FirewallRuleImpl(String name, SqlManager manager) { + super(name, new FirewallRuleInner()); + this.manager = manager; + // Set resource name + this.firewallRuleName = name; + // + } + + FirewallRuleImpl(FirewallRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.firewallRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.firewallRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "firewallRules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.getAsync(this.resourceGroupName, this.serverName, this.firewallRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String endIpAddress() { + return this.inner().endIpAddress(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String startIpAddress() { + return this.inner().startIpAddress(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.inner().withEndIpAddress(endIpAddress); + return this; + } + + @Override + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.inner().withStartIpAddress(startIpAddress); + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleInner.java new file mode 100644 index 0000000000000..1c40ee8196fa4 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRuleInner.java @@ -0,0 +1,75 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ProxyResourceWithWritableName; + +/** + * A server firewall rule. + */ +@JsonFlatten +public class FirewallRuleInner extends ProxyResourceWithWritableName { + /** + * The start IP address of the firewall rule. Must be IPv4 format. Use + * value '0.0.0.0' for all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.startIpAddress") + private String startIpAddress; + + /** + * The end IP address of the firewall rule. Must be IPv4 format. Must be + * greater than or equal to startIpAddress. Use value '0.0.0.0' for all + * Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.endIpAddress") + private String endIpAddress; + + /** + * Get the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' for all Azure-internal IP addresses. + * + * @return the startIpAddress value + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' for all Azure-internal IP addresses. + * + * @param startIpAddress the startIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' for all Azure-internal IP addresses. + * + * @return the endIpAddress value + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' for all Azure-internal IP addresses. + * + * @param endIpAddress the endIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..5abb90e0dbcb5 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java @@ -0,0 +1,93 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FirewallRules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FirewallRule; + +class FirewallRulesImpl extends WrapperImpl implements FirewallRules { + private final SqlManager manager; + + FirewallRulesImpl(SqlManager manager) { + super(manager.inner().firewallRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public FirewallRuleImpl define(String name) { + return wrapModel(name); + } + + private FirewallRuleImpl wrapModel(FirewallRuleInner inner) { + return new FirewallRuleImpl(inner, manager()); + } + + private FirewallRuleImpl wrapModel(String name) { + return new FirewallRuleImpl(name, this.manager()); + } + + @Override + public Observable replaceAsync(String resourceGroupName, String serverName) { + FirewallRulesInner client = this.inner(); + return client.replaceAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return new FirewallRuleImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + FirewallRulesInner 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 FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, firewallRuleName) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, firewallRuleName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java new file mode 100644 index 0000000000000..f9a0175d949e7 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java @@ -0,0 +1,789 @@ +/** + * 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.v2015_05_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.v2015_05_01_preview.FirewallRuleList; +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 FirewallRules. + */ +public class FirewallRulesInner { + /** The Retrofit service to perform REST calls. */ + private FirewallRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(FirewallRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallRules to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.FirewallRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @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.v2015_05_01_preview.FirewallRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Path("subscriptionId") String subscriptionId, @Body FirewallRuleInner 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.v2015_05_01_preview.FirewallRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @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.v2015_05_01_preview.FirewallRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules") + 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.v2015_05_01_preview.FirewallRules replace" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules") + Observable> replace(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body FirewallRuleList parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.FirewallRules listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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, firewallRuleName, 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 firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 firewallRuleName, FirewallRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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.createOrUpdate(resourceGroupName, serverName, firewallRuleName, 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 a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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.delete(resourceGroupName, serverName, firewallRuleName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of firewall rules. + * + * @param resourceGroupName The 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<FirewallRuleInner> 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 firewall rules. + * + * @param resourceGroupName The 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 firewall rules. + * + * @param resourceGroupName The 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<FirewallRuleInner> 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 firewall rules. + * + * @param resourceGroupName The 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<FirewallRuleInner> 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 firewall rules. + * + 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<FirewallRuleInner> 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); + } + + /** + * Replaces all firewall rules on the 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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner replace(String resourceGroupName, String serverName) { + return replaceWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Replaces all firewall rules on the 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 replaceAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(replaceWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Replaces all firewall rules on the 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 FirewallRuleInner object + */ + public Observable replaceAsync(String resourceGroupName, String serverName) { + return replaceWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Replaces all firewall rules on the 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 FirewallRuleInner object + */ + public Observable> replaceWithServiceResponseAsync(String resourceGroupName, 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."); + } + final List values = null; + FirewallRuleList parameters = new FirewallRuleList(); + parameters.withValues(null); + return service.replace(resourceGroupName, serverName, 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 = replaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Replaces all firewall rules on the 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 values the List<FirewallRuleInner> 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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner replace(String resourceGroupName, String serverName, List values) { + return replaceWithServiceResponseAsync(resourceGroupName, serverName, values).toBlocking().single().body(); + } + + /** + * Replaces all firewall rules on the 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 values the List<FirewallRuleInner> 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 replaceAsync(String resourceGroupName, String serverName, List values, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(replaceWithServiceResponseAsync(resourceGroupName, serverName, values), serviceCallback); + } + + /** + * Replaces all firewall rules on the 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 values the List<FirewallRuleInner> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable replaceAsync(String resourceGroupName, String serverName, List values) { + return replaceWithServiceResponseAsync(resourceGroupName, serverName, values).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Replaces all firewall rules on the 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 values the List<FirewallRuleInner> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> replaceWithServiceResponseAsync(String resourceGroupName, String serverName, List values) { + 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."); + } + Validator.validate(values); + FirewallRuleList parameters = new FirewallRuleList(); + parameters.withValues(values); + return service.replace(resourceGroupName, serverName, 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 = replaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse replaceDelegate(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 firewall rules. + * + * @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<FirewallRuleInner> 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 firewall rules. + * + * @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 firewall rules. + * + * @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<FirewallRuleInner> 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 firewall rules. + * + * @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<FirewallRuleInner> 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 firewall rules. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallRuleInner> 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/IdParsingUtils.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..184e64dae45f6 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2015_05_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java new file mode 100644 index 0000000000000..1500a0ca9852c --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java @@ -0,0 +1,230 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstance; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceUpdate; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; +import rx.functions.Func1; + +class ManagedInstanceImpl extends GroupableResourceCoreImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { + private ManagedInstanceUpdate updateParameter; + ManagedInstanceImpl(String name, ManagedInstanceInner inner, SqlManager manager) { + super(name, inner, manager); + this.updateParameter = new ManagedInstanceUpdate(); + } + + @Override + public Observable createResourceAsync() { + ManagedInstancesInner client = this.manager().inner().managedInstances(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), 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.name(), 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 client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @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 ResourceIdentity identity() { + return this.inner().identity(); + } + + @Override + public String licenseType() { + return this.inner().licenseType(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @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 Integer vCores() { + return this.inner().vCores(); + } + + @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 withLicenseType(String licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public ManagedInstanceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + 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 withVCores(Integer vCores) { + if (isInCreateMode()) { + this.inner().withVCores(vCores); + } else { + this.updateParameter.withVCores(vCores); + } + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java new file mode 100644 index 0000000000000..2fc537c23f6f7 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java @@ -0,0 +1,331 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; +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. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * 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' and 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * The number of VCores. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * The maximum storage size in GB. + */ + @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; + + /** + * 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. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set managed instance sku. + * + * @param sku the sku value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSku(Sku sku) { + this.sku = sku; + 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' and 'BasePrice'. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the number of VCores. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the number of VCores. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the maximum storage size in GB. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the maximum storage size in GB. + * + * @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; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.java new file mode 100644 index 0000000000000..97820344672d3 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstance; +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 ManagedInstancesImpl extends GroupableResourcesCoreImpl implements ManagedInstances { + protected ManagedInstancesImpl(SqlManager manager) { + super(manager.inner().managedInstances(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ManagedInstancesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ManagedInstancesInner 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) { + ManagedInstancesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(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 wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ManagedInstancesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @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 wrapModel(inner); + } + }); + } + + @Override + public ManagedInstanceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ManagedInstanceImpl wrapModel(ManagedInstanceInner inner) { + return new ManagedInstanceImpl(inner.name(), inner, manager()); + } + + @Override + protected ManagedInstanceImpl wrapModel(String name) { + return new ManagedInstanceImpl(name, new ManagedInstanceInner(), this.manager()); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java new file mode 100644 index 0000000000000..2ecb94ce48b0f --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java @@ -0,0 +1,1145 @@ +/** + * 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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_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.v2015_05_01_preview.ManagedInstances listNext" }) + @GET + Observable> listNext(@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.v2015_05_01_preview.ManagedInstances listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 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. + * + * @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); + } + + /** + * 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); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationImpl.java new file mode 100644 index 0000000000000..2e77659693867 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.OperationDisplay; +import com.microsoft.azure.management.sql.v2015_05_01_preview.OperationOrigin; +import java.util.Map; + +class OperationImpl extends WrapperImpl implements Operation { + private final SqlManager manager; + OperationImpl(OperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public OperationOrigin origin() { + return this.inner().origin(); + } + + @Override + public Map properties() { + return this.inner().properties(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationInner.java new file mode 100644 index 0000000000000..b82742af519f8 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationInner.java @@ -0,0 +1,82 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.OperationDisplay; +import com.microsoft.azure.management.sql.v2015_05_01_preview.OperationOrigin; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SQL REST API operation definition. + */ +public class OperationInner { + /** + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The localized display information for this particular operation / + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /** + * The intended executor of the operation. Possible values include: 'user', + * 'system'. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /** + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Map properties; + + /** + * Get the name of the operation being performed on this particular object. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the localized display information for this particular operation / action. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the intended executor of the operation. Possible values include: 'user', 'system'. + * + * @return the origin value + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get additional descriptions for the operation. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..85450a9736ed9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final SqlManager manager; + + OperationsImpl(SqlManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..bda59c03083ac --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.v2015_05_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.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 Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.Operations list" }) + @GET("providers/Microsoft.Sql/operations") + Observable> list(@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.v2015_05_01_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> 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(); + } + }; + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> 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)); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(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); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> 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(); + } + }; + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> 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)); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/PageImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..e9db20d8c60a2 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionImpl.java new file mode 100644 index 0000000000000..bc1ed3f2e83c8 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionImpl.java @@ -0,0 +1,244 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedAction; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionStateInfo; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionErrorInfo; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionImpactRecord; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionInitiatedBy; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionImplementationInfo; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionMetricInfo; +import rx.functions.Func1; + +class RecommendedActionImpl extends CreatableUpdatableImpl implements RecommendedAction, RecommendedAction.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String advisorName; + private String recommendedActionName; + private RecommendedActionStateInfo ustate; + + RecommendedActionImpl(String name, SqlManager manager) { + super(name, new RecommendedActionInner()); + this.manager = manager; + // Set resource name + this.recommendedActionName = name; + // + this.ustate = new RecommendedActionStateInfo(); + } + + RecommendedActionImpl(RecommendedActionInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.recommendedActionName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.advisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "advisors"); + this.recommendedActionName = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendedActions"); + // + this.ustate = new RecommendedActionStateInfo(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabaseRecommendedActionsInner client = this.manager().inner().databaseRecommendedActions(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + DatabaseRecommendedActionsInner client = this.manager().inner().databaseRecommendedActions(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.advisorName, this.recommendedActionName, this.ustate) + .map(new Func1() { + @Override + public RecommendedActionInner call(RecommendedActionInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseRecommendedActionsInner client = this.manager().inner().databaseRecommendedActions(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.advisorName, this.recommendedActionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.ustate = new RecommendedActionStateInfo(); + } + + @Override + public Map details() { + return this.inner().details(); + } + + @Override + public RecommendedActionErrorInfo errorDetails() { + return this.inner().errorDetails(); + } + + @Override + public List estimatedImpact() { + return this.inner().estimatedImpact(); + } + + @Override + public String executeActionDuration() { + return this.inner().executeActionDuration(); + } + + @Override + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.inner().executeActionInitiatedBy(); + } + + @Override + public DateTime executeActionInitiatedTime() { + return this.inner().executeActionInitiatedTime(); + } + + @Override + public DateTime executeActionStartTime() { + return this.inner().executeActionStartTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public RecommendedActionImplementationInfo implementationDetails() { + return this.inner().implementationDetails(); + } + + @Override + public Boolean isArchivedAction() { + return this.inner().isArchivedAction(); + } + + @Override + public Boolean isExecutableAction() { + return this.inner().isExecutableAction(); + } + + @Override + public Boolean isRevertableAction() { + return this.inner().isRevertableAction(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DateTime lastRefresh() { + return this.inner().lastRefresh(); + } + + @Override + public List linkedObjects() { + return this.inner().linkedObjects(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List observedImpact() { + return this.inner().observedImpact(); + } + + @Override + public String recommendationReason() { + return this.inner().recommendationReason(); + } + + @Override + public String revertActionDuration() { + return this.inner().revertActionDuration(); + } + + @Override + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.inner().revertActionInitiatedBy(); + } + + @Override + public DateTime revertActionInitiatedTime() { + return this.inner().revertActionInitiatedTime(); + } + + @Override + public DateTime revertActionStartTime() { + return this.inner().revertActionStartTime(); + } + + @Override + public Integer score() { + return this.inner().score(); + } + + @Override + public RecommendedActionStateInfo state() { + return this.inner().state(); + } + + @Override + public List timeSeries() { + return this.inner().timeSeries(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime validSince() { + return this.inner().validSince(); + } + + @Override + public RecommendedActionImpl withState(RecommendedActionStateInfo state) { + this.ustate = state; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionInner.java new file mode 100644 index 0000000000000..74c4000a06cda --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/RecommendedActionInner.java @@ -0,0 +1,429 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionStateInfo; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionInitiatedBy; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionImplementationInfo; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionErrorInfo; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionImpactRecord; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedActionMetricInfo; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Database, Server or Elastic Pool Recommended Action. + */ +@JsonFlatten +public class RecommendedActionInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Gets the reason for recommending this action. e.g., DuplicateIndex. + */ + @JsonProperty(value = "properties.recommendationReason", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationReason; + + /** + * Gets the time since when this recommended action is valid. + */ + @JsonProperty(value = "properties.validSince", access = JsonProperty.Access.WRITE_ONLY) + private DateTime validSince; + + /** + * Gets time when this recommended action was last refreshed. + */ + @JsonProperty(value = "properties.lastRefresh", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastRefresh; + + /** + * Gets the info of the current state the recommended action is in. + */ + @JsonProperty(value = "properties.state", required = true) + private RecommendedActionStateInfo state; + + /** + * Gets if this recommended action is actionable by user. + */ + @JsonProperty(value = "properties.isExecutableAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isExecutableAction; + + /** + * Gets if changes applied by this recommended action can be reverted by + * user. + */ + @JsonProperty(value = "properties.isRevertableAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isRevertableAction; + + /** + * Gets if this recommended action was suggested some time ago but user + * chose to ignore this and system added a new recommended action again. + */ + @JsonProperty(value = "properties.isArchivedAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isArchivedAction; + + /** + * Gets the time when system started applying this recommended action on + * the user resource. e.g., index creation start time. + */ + @JsonProperty(value = "properties.executeActionStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime executeActionStartTime; + + /** + * Gets the time taken for applying this recommended action on user + * resource. e.g., time taken for index creation. + */ + @JsonProperty(value = "properties.executeActionDuration", access = JsonProperty.Access.WRITE_ONLY) + private String executeActionDuration; + + /** + * Gets the time when system started reverting changes of this recommended + * action on user resource. e.g., time when index drop is executed. + */ + @JsonProperty(value = "properties.revertActionStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime revertActionStartTime; + + /** + * Gets the time taken for reverting changes of this recommended action on + * user resource. e.g., time taken for dropping the created index. + */ + @JsonProperty(value = "properties.revertActionDuration", access = JsonProperty.Access.WRITE_ONLY) + private String revertActionDuration; + + /** + * Gets if approval for applying this recommended action was given by + * user/system. Possible values include: 'User', 'System'. + */ + @JsonProperty(value = "properties.executeActionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy executeActionInitiatedBy; + + /** + * Gets the time when this recommended action was approved for execution. + */ + @JsonProperty(value = "properties.executeActionInitiatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime executeActionInitiatedTime; + + /** + * Gets if approval for reverting this recommended action was given by + * user/system. Possible values include: 'User', 'System'. + */ + @JsonProperty(value = "properties.revertActionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy revertActionInitiatedBy; + + /** + * Gets the time when this recommended action was approved for revert. + */ + @JsonProperty(value = "properties.revertActionInitiatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime revertActionInitiatedTime; + + /** + * Gets the impact of this recommended action. Possible values are 1 - Low + * impact, 2 - Medium Impact and 3 - High Impact. + */ + @JsonProperty(value = "properties.score", access = JsonProperty.Access.WRITE_ONLY) + private Integer score; + + /** + * Gets the implementation details of this recommended action for user to + * apply it manually. + */ + @JsonProperty(value = "properties.implementationDetails", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionImplementationInfo implementationDetails; + + /** + * Gets the error details if and why this recommended action is put to + * error state. + */ + @JsonProperty(value = "properties.errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionErrorInfo errorDetails; + + /** + * Gets the estimated impact info for this recommended action e.g., + * Estimated CPU gain, Estimated Disk Space change. + */ + @JsonProperty(value = "properties.estimatedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List estimatedImpact; + + /** + * Gets the observed/actual impact info for this recommended action e.g., + * Actual CPU gain, Actual Disk Space change. + */ + @JsonProperty(value = "properties.observedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List observedImpact; + + /** + * Gets the time series info of metrics for this recommended action e.g., + * CPU consumption time series. + */ + @JsonProperty(value = "properties.timeSeries", access = JsonProperty.Access.WRITE_ONLY) + private List timeSeries; + + /** + * Gets the linked objects, if any. + */ + @JsonProperty(value = "properties.linkedObjects", access = JsonProperty.Access.WRITE_ONLY) + private List linkedObjects; + + /** + * Gets additional details specific to this recommended action. + */ + @JsonProperty(value = "properties.details", access = JsonProperty.Access.WRITE_ONLY) + private Map details; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get gets the reason for recommending this action. e.g., DuplicateIndex. + * + * @return the recommendationReason value + */ + public String recommendationReason() { + return this.recommendationReason; + } + + /** + * Get gets the time since when this recommended action is valid. + * + * @return the validSince value + */ + public DateTime validSince() { + return this.validSince; + } + + /** + * Get gets time when this recommended action was last refreshed. + * + * @return the lastRefresh value + */ + public DateTime lastRefresh() { + return this.lastRefresh; + } + + /** + * Get gets the info of the current state the recommended action is in. + * + * @return the state value + */ + public RecommendedActionStateInfo state() { + return this.state; + } + + /** + * Set gets the info of the current state the recommended action is in. + * + * @param state the state value to set + * @return the RecommendedActionInner object itself. + */ + public RecommendedActionInner withState(RecommendedActionStateInfo state) { + this.state = state; + return this; + } + + /** + * Get gets if this recommended action is actionable by user. + * + * @return the isExecutableAction value + */ + public Boolean isExecutableAction() { + return this.isExecutableAction; + } + + /** + * Get gets if changes applied by this recommended action can be reverted by user. + * + * @return the isRevertableAction value + */ + public Boolean isRevertableAction() { + return this.isRevertableAction; + } + + /** + * Get gets if this recommended action was suggested some time ago but user chose to ignore this and system added a new recommended action again. + * + * @return the isArchivedAction value + */ + public Boolean isArchivedAction() { + return this.isArchivedAction; + } + + /** + * Get gets the time when system started applying this recommended action on the user resource. e.g., index creation start time. + * + * @return the executeActionStartTime value + */ + public DateTime executeActionStartTime() { + return this.executeActionStartTime; + } + + /** + * Get gets the time taken for applying this recommended action on user resource. e.g., time taken for index creation. + * + * @return the executeActionDuration value + */ + public String executeActionDuration() { + return this.executeActionDuration; + } + + /** + * Get gets the time when system started reverting changes of this recommended action on user resource. e.g., time when index drop is executed. + * + * @return the revertActionStartTime value + */ + public DateTime revertActionStartTime() { + return this.revertActionStartTime; + } + + /** + * Get gets the time taken for reverting changes of this recommended action on user resource. e.g., time taken for dropping the created index. + * + * @return the revertActionDuration value + */ + public String revertActionDuration() { + return this.revertActionDuration; + } + + /** + * Get gets if approval for applying this recommended action was given by user/system. Possible values include: 'User', 'System'. + * + * @return the executeActionInitiatedBy value + */ + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.executeActionInitiatedBy; + } + + /** + * Get gets the time when this recommended action was approved for execution. + * + * @return the executeActionInitiatedTime value + */ + public DateTime executeActionInitiatedTime() { + return this.executeActionInitiatedTime; + } + + /** + * Get gets if approval for reverting this recommended action was given by user/system. Possible values include: 'User', 'System'. + * + * @return the revertActionInitiatedBy value + */ + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.revertActionInitiatedBy; + } + + /** + * Get gets the time when this recommended action was approved for revert. + * + * @return the revertActionInitiatedTime value + */ + public DateTime revertActionInitiatedTime() { + return this.revertActionInitiatedTime; + } + + /** + * Get gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - Medium Impact and 3 - High Impact. + * + * @return the score value + */ + public Integer score() { + return this.score; + } + + /** + * Get gets the implementation details of this recommended action for user to apply it manually. + * + * @return the implementationDetails value + */ + public RecommendedActionImplementationInfo implementationDetails() { + return this.implementationDetails; + } + + /** + * Get gets the error details if and why this recommended action is put to error state. + * + * @return the errorDetails value + */ + public RecommendedActionErrorInfo errorDetails() { + return this.errorDetails; + } + + /** + * Get gets the estimated impact info for this recommended action e.g., Estimated CPU gain, Estimated Disk Space change. + * + * @return the estimatedImpact value + */ + public List estimatedImpact() { + return this.estimatedImpact; + } + + /** + * Get gets the observed/actual impact info for this recommended action e.g., Actual CPU gain, Actual Disk Space change. + * + * @return the observedImpact value + */ + public List observedImpact() { + return this.observedImpact; + } + + /** + * Get gets the time series info of metrics for this recommended action e.g., CPU consumption time series. + * + * @return the timeSeries value + */ + public List timeSeries() { + return this.timeSeries; + } + + /** + * Get gets the linked objects, if any. + * + * @return the linkedObjects value + */ + public List linkedObjects() { + return this.linkedObjects; + } + + /** + * Get gets additional details specific to this recommended action. + * + * @return the details value + */ + public Map details() { + return this.details; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorImpl.java new file mode 100644 index 0000000000000..455a6edbc4173 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorImpl.java @@ -0,0 +1,146 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerAdvisor; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatus; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AdvisorStatus; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatusInheritedFrom; +import org.joda.time.DateTime; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v2015_05_01_preview.RecommendedAction; +import java.util.List; + +class ServerAdvisorImpl extends CreatableUpdatableImpl implements ServerAdvisor, ServerAdvisor.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String advisorName; + private AutoExecuteStatus uautoExecuteStatus; + + ServerAdvisorImpl(String name, SqlManager manager) { + super(name, new AdvisorInner()); + this.manager = manager; + // Set resource name + this.advisorName = name; + // + } + + ServerAdvisorImpl(AdvisorInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.advisorName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.advisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "advisors"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerAdvisorsInner client = this.manager().inner().serverAdvisors(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + ServerAdvisorsInner client = this.manager().inner().serverAdvisors(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.advisorName, this.uautoExecuteStatus) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerAdvisorsInner client = this.manager().inner().serverAdvisors(); + return client.getAsync(this.resourceGroupName, this.serverName, this.advisorName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AdvisorStatus advisorStatus() { + return this.inner().advisorStatus(); + } + + @Override + public AutoExecuteStatus autoExecuteStatus() { + return this.inner().autoExecuteStatus(); + } + + @Override + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.inner().autoExecuteStatusInheritedFrom(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DateTime lastChecked() { + return this.inner().lastChecked(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recommendationsStatus() { + return this.inner().recommendationsStatus(); + } + + @Override + public List recommendedActions() { + List lst = new ArrayList(); + if (this.inner().recommendedActions() != null) { + for (RecommendedActionInner inner : this.inner().recommendedActions()) { + lst.add( new RecommendedActionImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerAdvisorImpl withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { + this.uautoExecuteStatus = autoExecuteStatus; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.java new file mode 100644 index 0000000000000..1dcd0dbf395ae --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerAdvisors; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerAdvisor; + +class ServerAdvisorsImpl extends WrapperImpl implements ServerAdvisors { + private final SqlManager manager; + + ServerAdvisorsImpl(SqlManager manager) { + super(manager.inner().serverAdvisors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServerAdvisorImpl wrapModel(AdvisorInner inner) { + return new ServerAdvisorImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerAdvisorsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServerAdvisor call(AdvisorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String advisorName) { + ServerAdvisorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, advisorName) + .map(new Func1() { + @Override + public ServerAdvisor call(AdvisorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java new file mode 100644 index 0000000000000..d2d9217ff8a10 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java @@ -0,0 +1,353 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2015_05_01_preview.AutoExecuteStatus; +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.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 ServerAdvisors. + */ +public class ServerAdvisorsInner { + /** The Retrofit service to perform REST calls. */ + private ServerAdvisorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAdvisorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerAdvisorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerAdvisorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerAdvisors to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerAdvisorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ServerAdvisors listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors") + 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.v2015_05_01_preview.ServerAdvisors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("advisorName") String advisorName, @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.v2015_05_01_preview.ServerAdvisors update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("advisorName") String advisorName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AdvisorInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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 List<AdvisorInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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 List<AdvisorInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The 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 List<AdvisorInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(String resourceGroupName, 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> clientResponse = listByServerDelegate(response); + return Observable.just(clientResponse); + } 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 server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @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 AdvisorInner object if successful. + */ + public AdvisorInner get(String resourceGroupName, String serverName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, advisorName).toBlocking().single().body(); + } + + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @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 advisorName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, advisorName), serviceCallback); + } + + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String advisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, advisorName).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String advisorName) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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, advisorName, 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); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 AdvisorInner object if successful. + */ + public AdvisorInner update(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteStatus) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteStatus).toBlocking().single().body(); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @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 serverName, String advisorName, AutoExecuteStatus autoExecuteStatus, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteStatus), serviceCallback); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteStatus) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteStatus).map(new Func1, AdvisorInner>() { + @Override + public AdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a server advisor. + * + * @param resourceGroupName The 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 advisorName The name of the Server Advisor. + * @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdvisorInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteStatus) { + 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 (advisorName == null) { + throw new IllegalArgumentException("Parameter advisorName 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 (autoExecuteStatus == null) { + throw new IllegalArgumentException("Parameter autoExecuteStatus is required and cannot be null."); + } + AdvisorInner parameters = new AdvisorInner(); + parameters.withAutoExecuteStatus(autoExecuteStatus); + return service.update(resourceGroupName, serverName, advisorName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerImpl.java new file mode 100644 index 0000000000000..5ecca2d6922c9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Server; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerUpdate; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; +import rx.functions.Func1; + +class ServerImpl extends GroupableResourceCoreImpl implements Server, Server.Definition, Server.Update { + private ServerUpdate updateParameter; + ServerImpl(String name, ServerInner inner, SqlManager manager) { + super(name, inner, manager); + this.updateParameter = new ServerUpdate(); + } + + @Override + public Observable createResourceAsync() { + ServersInner client = this.manager().inner().servers(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ServerInner call(ServerInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServersInner client = this.manager().inner().servers(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ServerInner call(ServerInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServersInner client = this.manager().inner().servers(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ServerUpdate(); + } + + @Override + public String administratorLogin() { + return this.inner().administratorLogin(); + } + + @Override + public String administratorLoginPassword() { + return this.inner().administratorLoginPassword(); + } + + @Override + public String fullyQualifiedDomainName() { + return this.inner().fullyQualifiedDomainName(); + } + + @Override + public ResourceIdentity identity() { + return this.inner().identity(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String version() { + return this.inner().version(); + } + + @Override + public ServerImpl withIdentity(ResourceIdentity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public ServerImpl withAdministratorLogin(String administratorLogin) { + if (isInCreateMode()) { + this.inner().withAdministratorLogin(administratorLogin); + } else { + this.updateParameter.withAdministratorLogin(administratorLogin); + } + return this; + } + + @Override + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.inner().withAdministratorLoginPassword(administratorLoginPassword); + } else { + this.updateParameter.withAdministratorLoginPassword(administratorLoginPassword); + } + return this; + } + + @Override + public ServerImpl withVersion(String version) { + if (isInCreateMode()) { + this.inner().withVersion(version); + } else { + this.updateParameter.withVersion(version); + } + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerInner.java new file mode 100644 index 0000000000000..31b188ce5be67 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerInner.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL Database server. + */ +@JsonFlatten +public class ServerInner extends Resource { + /** + * The Azure Active Directory identity of the server. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /** + * Kind of sql server. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The version of the server. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * The state of the server. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Get the Azure Active Directory identity of the server. + * + * @return the identity value + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the Azure Active Directory identity of the server. + * + * @param identity the identity value to set + * @return the ServerInner object itself. + */ + public ServerInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get kind of sql server. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the server. Once created it cannot be changed. + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for server creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version of the server. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version of the server. + * + * @param version the version value to set + * @return the ServerInner object itself. + */ + public ServerInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state of the server. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyImpl.java new file mode 100644 index 0000000000000..16561c30e96c3 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyImpl.java @@ -0,0 +1,161 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKey; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKeyType; +import org.joda.time.DateTime; + +class ServerKeyImpl extends CreatableUpdatableImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String keyName; + + ServerKeyImpl(String name, SqlManager manager) { + super(name, new ServerKeyInner()); + this.manager = manager; + // Set resource name + this.keyName = name; + // + } + + ServerKeyImpl(ServerKeyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.keyName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.keyName = IdParsingUtils.getValueFromIdByName(inner.id(), "keys"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerKeysInner client = this.manager().inner().serverKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerKeysInner client = this.manager().inner().serverKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerKeysInner client = this.manager().inner().serverKeys(); + return client.getAsync(this.resourceGroupName, this.serverName, this.keyName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String subregion() { + return this.inner().subregion(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + + @Override + public ServerKeyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.inner().withServerKeyType(serverKeyType); + return this; + } + + @Override + public ServerKeyImpl withCreationDate(DateTime creationDate) { + this.inner().withCreationDate(creationDate); + return this; + } + + @Override + public ServerKeyImpl withKind(String kind) { + this.inner().withKind(kind); + return this; + } + + @Override + public ServerKeyImpl withThumbprint(String thumbprint) { + this.inner().withThumbprint(thumbprint); + return this; + } + + @Override + public ServerKeyImpl withUri(String uri) { + this.inner().withUri(uri); + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyInner.java new file mode 100644 index 0000000000000..ee507b897c443 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeyInner.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKeyType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server key. + */ +@JsonFlatten +public class ServerKeyInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Subregion of the server key. + */ + @JsonProperty(value = "properties.subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /** + * The server key type like 'ServiceManaged', 'AzureKeyVault'. Possible + * values include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /** + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint") + private String thumbprint; + + /** + * The server key creation date. + */ + @JsonProperty(value = "properties.creationDate") + private DateTime creationDate; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Set kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @param kind the kind value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get subregion of the server key. + * + * @return the subregion value + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the server key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the server key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the server key. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the server key. + * + * @param uri the uri value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get thumbprint of the server key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set thumbprint of the server key. + * + * @param thumbprint the thumbprint value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the server key creation date. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Set the server key creation date. + * + * @param creationDate the creationDate value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withCreationDate(DateTime creationDate) { + this.creationDate = creationDate; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java new file mode 100644 index 0000000000000..1a786d771606a --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKeys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKey; + +class ServerKeysImpl extends WrapperImpl implements ServerKeys { + private final SqlManager manager; + + ServerKeysImpl(SqlManager manager) { + super(manager.inner().serverKeys()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerKeyImpl define(String name) { + return wrapModel(name); + } + + private ServerKeyImpl wrapModel(ServerKeyInner inner) { + return new ServerKeyImpl(inner, manager()); + } + + private ServerKeyImpl wrapModel(String name) { + return new ServerKeyImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerKeysInner 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 ServerKey call(ServerKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String keyName) { + ServerKeysInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, keyName) + .map(new Func1() { + @Override + public ServerKey call(ServerKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String keyName) { + ServerKeysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, keyName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java new file mode 100644 index 0000000000000..7040532f9eb34 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java @@ -0,0 +1,777 @@ +/** + * 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.v2015_05_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 ServerKeys. + */ +public class ServerKeysInner { + /** The Retrofit service to perform REST calls. */ + private ServerKeysService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerKeysInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKeys listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys") + 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.v2015_05_01_preview.ServerKeys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @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.v2015_05_01_preview.ServerKeys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ServerKeyInner 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.v2015_05_01_preview.ServerKeys beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ServerKeyInner 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.v2015_05_01_preview.ServerKeys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @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.v2015_05_01_preview.ServerKeys beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @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.v2015_05_01_preview.ServerKeys listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The 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<ServerKeyInner> 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 keys. + * + * @param resourceGroupName The 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 keys. + * + * @param resourceGroupName The 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<ServerKeyInner> 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 keys. + * + * @param resourceGroupName The 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<ServerKeyInner> 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 keys. + * + 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<ServerKeyInner> 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 a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key 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 ServerKeyInner object if successful. + */ + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, keyName).toBlocking().single().body(); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key 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 getAsync(String resourceGroupName, String serverName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, keyName), serviceCallback); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, keyName).map(new Func1, ServerKeyInner>() { + @Override + public ServerKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 ServerKeyInner object if successful. + */ + public ServerKeyInner createOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 serverName, String keyName, ServerKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).map(new Func1, ServerKeyInner>() { + @Override + public ServerKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 ServerKeyInner object if successful. + */ + public ServerKeyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 serverName, String keyName, ServerKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).map(new Func1, ServerKeyInner>() { + @Override + public ServerKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 the server key with the 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 keyName The name of the server key 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 serverName, String keyName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).toBlocking().last().body(); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key 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 serverName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, keyName), serviceCallback); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String keyName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key 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 serverName, String keyName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).toBlocking().single().body(); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key 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 serverName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, keyName), serviceCallback); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String keyName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 a list of server keys. + * + * @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<ServerKeyInner> 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 keys. + * + * @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 keys. + * + * @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<ServerKeyInner> 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 keys. + * + * @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<ServerKeyInner> 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 keys. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerKeyInner> 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersImpl.java new file mode 100644 index 0000000000000..542b2fd36b036 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Servers; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Server; +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 ServersImpl extends GroupableResourcesCoreImpl implements Servers { + protected ServersImpl(SqlManager manager) { + super(manager.inner().servers(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ServersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ServersInner 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) { + ServersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ServersInner 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 Server call(ServerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ServersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ServersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Server call(ServerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ServerImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ServerImpl wrapModel(ServerInner inner) { + return new ServerImpl(inner.name(), inner, manager()); + } + + @Override + protected ServerImpl wrapModel(String name) { + return new ServerImpl(name, new ServerInner(), this.manager()); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java new file mode 100644 index 0000000000000..be2985f54201b --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java @@ -0,0 +1,1145 @@ +/** + * 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.v2015_05_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.v2015_05_01_preview.ServerUpdate; +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 Servers. + */ +public class ServersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ServersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Servers to be + * used by Retrofit to perform actually REST calls. + */ + interface ServersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.Servers list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers") + 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.v2015_05_01_preview.Servers listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers") + 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.v2015_05_01_preview.Servers getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> getByResourceGroup(@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.v2015_05_01_preview.Servers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerInner 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.v2015_05_01_preview.Servers beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerInner 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.v2015_05_01_preview.Servers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2015_05_01_preview.Servers beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2015_05_01_preview.Servers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdate 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.v2015_05_01_preview.Servers beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdate 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.v2015_05_01_preview.Servers listNext" }) + @GET + Observable> listNext(@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.v2015_05_01_preview.Servers listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of all servers 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<ServerInner> 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 servers 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 servers in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all servers in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerInner> 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 servers in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerInner> 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 servers in a resource groups. + * + * @param resourceGroupName 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<ServerInner> 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 servers in a resource groups. + * + * @param resourceGroupName The 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 servers in a resource groups. + * + * @param resourceGroupName 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<ServerInner> 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 servers in a resource groups. + * + * @param resourceGroupName 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<ServerInner> 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 servers in a resource groups. + * + 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<ServerInner> 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 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 ServerInner object if successful. + */ + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets 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 getByResourceGroupAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets 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 ServerInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 ServerInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, 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.getByResourceGroup(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 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 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates 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 parameters The requested server 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 serverName, ServerInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerInner 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 (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, 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 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates 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 parameters The requested server 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 serverName, ServerInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerInner 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 (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, 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 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 + */ + public void delete(String resourceGroupName, String serverName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().last().body(); + } + + /** + * Deletes 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 deleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes 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 + */ + 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 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 + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, 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."); + } + Observable> observable = service.delete(resourceGroupName, serverName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes 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 + */ + public void beginDelete(String resourceGroupName, String serverName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Deletes 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 beginDeleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes 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 {@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 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 {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, 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.beginDelete(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 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 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Updates 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 parameters The requested server 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 serverName, ServerUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdate 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 (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, serverName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Updates 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 parameters The requested server 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 serverName, ServerUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdate 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 (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, serverName, 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 servers 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<ServerInner> 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 servers 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 servers 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<ServerInner> 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 servers 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<ServerInner> 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 servers 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<ServerInner> 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); + } + + /** + * Gets a list of servers in a resource groups. + * + * @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<ServerInner> 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 servers in a resource groups. + * + * @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 servers in a resource groups. + * + * @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<ServerInner> 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 servers in a resource groups. + * + * @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<ServerInner> 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 servers in a resource groups. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerInner> 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); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..b2b988c342258 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java @@ -0,0 +1,420 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DatabaseAdvisorsInner object to access its operations. + */ + private DatabaseAdvisorsInner databaseAdvisors; + + /** + * Gets the DatabaseAdvisorsInner object to access its operations. + * @return the DatabaseAdvisorsInner object. + */ + public DatabaseAdvisorsInner databaseAdvisors() { + return this.databaseAdvisors; + } + + /** + * The DatabaseRecommendedActionsInner object to access its operations. + */ + private DatabaseRecommendedActionsInner databaseRecommendedActions; + + /** + * Gets the DatabaseRecommendedActionsInner object to access its operations. + * @return the DatabaseRecommendedActionsInner object. + */ + public DatabaseRecommendedActionsInner databaseRecommendedActions() { + return this.databaseRecommendedActions; + } + + /** + * The ServerAdvisorsInner object to access its operations. + */ + private ServerAdvisorsInner serverAdvisors; + + /** + * Gets the ServerAdvisorsInner object to access its operations. + * @return the ServerAdvisorsInner object. + */ + public ServerAdvisorsInner serverAdvisors() { + return this.serverAdvisors; + } + + /** + * The DatabaseBlobAuditingPoliciesInner object to access its operations. + */ + private DatabaseBlobAuditingPoliciesInner databaseBlobAuditingPolicies; + + /** + * Gets the DatabaseBlobAuditingPoliciesInner object to access its operations. + * @return the DatabaseBlobAuditingPoliciesInner object. + */ + public DatabaseBlobAuditingPoliciesInner databaseBlobAuditingPolicies() { + return this.databaseBlobAuditingPolicies; + } + + /** + * The DatabaseAutomaticTuningsInner object to access its operations. + */ + private DatabaseAutomaticTuningsInner databaseAutomaticTunings; + + /** + * Gets the DatabaseAutomaticTuningsInner object to access its operations. + * @return the DatabaseAutomaticTuningsInner object. + */ + public DatabaseAutomaticTuningsInner databaseAutomaticTunings() { + return this.databaseAutomaticTunings; + } + + /** + * The EncryptionProtectorsInner object to access its operations. + */ + private EncryptionProtectorsInner encryptionProtectors; + + /** + * Gets the EncryptionProtectorsInner object to access its operations. + * @return the EncryptionProtectorsInner object. + */ + public EncryptionProtectorsInner encryptionProtectors() { + return this.encryptionProtectors; + } + + /** + * The FailoverGroupsInner object to access its operations. + */ + private FailoverGroupsInner failoverGroups; + + /** + * Gets the FailoverGroupsInner object to access its operations. + * @return the FailoverGroupsInner object. + */ + public FailoverGroupsInner failoverGroups() { + return this.failoverGroups; + } + + /** + * The FirewallRulesInner object to access its operations. + */ + private FirewallRulesInner firewallRules; + + /** + * Gets the FirewallRulesInner object to access its operations. + * @return the FirewallRulesInner object. + */ + public FirewallRulesInner firewallRules() { + return this.firewallRules; + } + + /** + * 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 OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The ServerKeysInner object to access its operations. + */ + private ServerKeysInner serverKeys; + + /** + * Gets the ServerKeysInner object to access its operations. + * @return the ServerKeysInner object. + */ + public ServerKeysInner serverKeys() { + return this.serverKeys; + } + + /** + * The ServersInner object to access its operations. + */ + private ServersInner servers; + + /** + * Gets the ServersInner object to access its operations. + * @return the ServersInner object. + */ + public ServersInner servers() { + return this.servers; + } + + /** + * The SyncAgentsInner object to access its operations. + */ + private SyncAgentsInner syncAgents; + + /** + * Gets the SyncAgentsInner object to access its operations. + * @return the SyncAgentsInner object. + */ + public SyncAgentsInner syncAgents() { + return this.syncAgents; + } + + /** + * The SyncGroupsInner object to access its operations. + */ + private SyncGroupsInner syncGroups; + + /** + * Gets the SyncGroupsInner object to access its operations. + * @return the SyncGroupsInner object. + */ + public SyncGroupsInner syncGroups() { + return this.syncGroups; + } + + /** + * The SyncMembersInner object to access its operations. + */ + private SyncMembersInner syncMembers; + + /** + * Gets the SyncMembersInner object to access its operations. + * @return the SyncMembersInner object. + */ + public SyncMembersInner syncMembers() { + return this.syncMembers; + } + + /** + * The SubscriptionUsagesInner object to access its operations. + */ + private SubscriptionUsagesInner subscriptionUsages; + + /** + * Gets the SubscriptionUsagesInner object to access its operations. + * @return the SubscriptionUsagesInner object. + */ + public SubscriptionUsagesInner subscriptionUsages() { + return this.subscriptionUsages; + } + + /** + * The VirtualNetworkRulesInner object to access its operations. + */ + private VirtualNetworkRulesInner virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesInner object to access its operations. + * @return the VirtualNetworkRulesInner object. + */ + public VirtualNetworkRulesInner virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-05-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.databaseAdvisors = new DatabaseAdvisorsInner(restClient().retrofit(), this); + this.databaseRecommendedActions = new DatabaseRecommendedActionsInner(restClient().retrofit(), this); + this.serverAdvisors = new ServerAdvisorsInner(restClient().retrofit(), this); + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.databaseAutomaticTunings = new DatabaseAutomaticTuningsInner(restClient().retrofit(), this); + this.encryptionProtectors = new EncryptionProtectorsInner(restClient().retrofit(), this); + this.failoverGroups = new FailoverGroupsInner(restClient().retrofit(), this); + this.firewallRules = new FirewallRulesInner(restClient().retrofit(), this); + this.managedInstances = new ManagedInstancesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.serverKeys = new ServerKeysInner(restClient().retrofit(), this); + this.servers = new ServersInner(restClient().retrofit(), this); + this.syncAgents = new SyncAgentsInner(restClient().retrofit(), this); + this.syncGroups = new SyncGroupsInner(restClient().retrofit(), this); + this.syncMembers = new SyncMembersInner(restClient().retrofit(), this); + this.subscriptionUsages = new SubscriptionUsagesInner(restClient().retrofit(), this); + this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2015-05-01-preview"); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java new file mode 100644 index 0000000000000..7fa51ffb32511 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java @@ -0,0 +1,291 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAdvisors; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseRecommendedActions; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerAdvisors; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseAutomaticTunings; +import com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtectors; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FailoverGroups; +import com.microsoft.azure.management.sql.v2015_05_01_preview.FirewallRules; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Operations; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ServerKeys; +import com.microsoft.azure.management.sql.v2015_05_01_preview.Servers; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgents; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroups; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMembers; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsages; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRules; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private DatabaseAdvisors databaseAdvisors; + private DatabaseRecommendedActions databaseRecommendedActions; + private ServerAdvisors serverAdvisors; + private DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies; + private DatabaseAutomaticTunings databaseAutomaticTunings; + private EncryptionProtectors encryptionProtectors; + private FailoverGroups failoverGroups; + private FirewallRules firewallRules; + private ManagedInstances managedInstances; + private Operations operations; + private ServerKeys serverKeys; + private Servers servers; + private SyncAgents syncAgents; + private SyncGroups syncGroups; + private SyncMembers syncMembers; + private SubscriptionUsages subscriptionUsages; + private VirtualNetworkRules virtualNetworkRules; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DatabaseAdvisors. + */ + public DatabaseAdvisors databaseAdvisors() { + if (this.databaseAdvisors == null) { + this.databaseAdvisors = new DatabaseAdvisorsImpl(this); + } + return this.databaseAdvisors; + } + + /** + * @return Entry point to manage DatabaseRecommendedActions. + */ + public DatabaseRecommendedActions databaseRecommendedActions() { + if (this.databaseRecommendedActions == null) { + this.databaseRecommendedActions = new DatabaseRecommendedActionsImpl(this); + } + return this.databaseRecommendedActions; + } + + /** + * @return Entry point to manage ServerAdvisors. + */ + public ServerAdvisors serverAdvisors() { + if (this.serverAdvisors == null) { + this.serverAdvisors = new ServerAdvisorsImpl(this); + } + return this.serverAdvisors; + } + + /** + * @return Entry point to manage DatabaseBlobAuditingPolicies. + */ + public DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies() { + if (this.databaseBlobAuditingPolicies == null) { + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesImpl(this); + } + return this.databaseBlobAuditingPolicies; + } + + /** + * @return Entry point to manage DatabaseAutomaticTunings. + */ + public DatabaseAutomaticTunings databaseAutomaticTunings() { + if (this.databaseAutomaticTunings == null) { + this.databaseAutomaticTunings = new DatabaseAutomaticTuningsImpl(this); + } + return this.databaseAutomaticTunings; + } + + /** + * @return Entry point to manage EncryptionProtectors. + */ + public EncryptionProtectors encryptionProtectors() { + if (this.encryptionProtectors == null) { + this.encryptionProtectors = new EncryptionProtectorsImpl(this); + } + return this.encryptionProtectors; + } + + /** + * @return Entry point to manage FailoverGroups. + */ + public FailoverGroups failoverGroups() { + if (this.failoverGroups == null) { + this.failoverGroups = new FailoverGroupsImpl(this); + } + return this.failoverGroups; + } + + /** + * @return Entry point to manage FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(this); + } + return this.firewallRules; + } + + /** + * @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 Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage ServerKeys. + */ + public ServerKeys serverKeys() { + if (this.serverKeys == null) { + this.serverKeys = new ServerKeysImpl(this); + } + return this.serverKeys; + } + + /** + * @return Entry point to manage Servers. + */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(this); + } + return this.servers; + } + + /** + * @return Entry point to manage SyncAgents. + */ + public SyncAgents syncAgents() { + if (this.syncAgents == null) { + this.syncAgents = new SyncAgentsImpl(this); + } + return this.syncAgents; + } + + /** + * @return Entry point to manage SyncGroups. + */ + public SyncGroups syncGroups() { + if (this.syncGroups == null) { + this.syncGroups = new SyncGroupsImpl(this); + } + return this.syncGroups; + } + + /** + * @return Entry point to manage SyncMembers. + */ + public SyncMembers syncMembers() { + if (this.syncMembers == null) { + this.syncMembers = new SyncMembersImpl(this); + } + return this.syncMembers; + } + + /** + * @return Entry point to manage SubscriptionUsages. + */ + public SubscriptionUsages subscriptionUsages() { + if (this.subscriptionUsages == null) { + this.subscriptionUsages = new SubscriptionUsagesImpl(this); + } + return this.subscriptionUsages; + } + + /** + * @return Entry point to manage VirtualNetworkRules. + */ + public VirtualNetworkRules virtualNetworkRules() { + if (this.virtualNetworkRules == null) { + this.virtualNetworkRules = new VirtualNetworkRulesImpl(this); + } + return this.virtualNetworkRules; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageImpl.java new file mode 100644 index 0000000000000..ffda66c32cee3 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsage; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class SubscriptionUsageImpl extends IndexableRefreshableWrapperImpl implements SubscriptionUsage { + private final SqlManager manager; + private String locationName; + private String usageName; + + SubscriptionUsageImpl(SubscriptionUsageInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.usageName = IdParsingUtils.getValueFromIdByName(inner.id(), "usages"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + SubscriptionUsagesInner client = this.manager().inner().subscriptionUsages(); + return client.getAsync(this.locationName, this.usageName); + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageInner.java new file mode 100644 index 0000000000000..d40c45d6c9c7f --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsageInner.java @@ -0,0 +1,80 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Usage Metric of a Subscription in a Location. + */ +@JsonFlatten +public class SubscriptionUsageInner extends ProxyResource { + /** + * User-readable name of the metric. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Current value of the metric. + */ + @JsonProperty(value = "properties.currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /** + * Boundary value of the metric. + */ + @JsonProperty(value = "properties.limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit of the metric. + */ + @JsonProperty(value = "properties.unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Get user-readable name of the metric. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get current value of the metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get boundary value of the metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit of the metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesImpl.java new file mode 100644 index 0000000000000..108c597c87e05 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesImpl.java @@ -0,0 +1,72 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsages; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsage; +import com.microsoft.azure.Page; + +class SubscriptionUsagesImpl extends WrapperImpl implements SubscriptionUsages { + private final SqlManager manager; + + SubscriptionUsagesImpl(SqlManager manager) { + super(manager.inner().subscriptionUsages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private SubscriptionUsageImpl wrapSubscriptionUsageModel(SubscriptionUsageInner inner) { + return new SubscriptionUsageImpl(inner, manager()); + } + + private Observable getSubscriptionUsageInnerUsingSubscriptionUsagesInnerAsync(String id) { + String locationName = IdParsingUtils.getValueFromIdByName(id, "locations"); + String usageName = IdParsingUtils.getValueFromIdByName(id, "usages"); + SubscriptionUsagesInner client = this.inner(); + return client.getAsync(locationName, usageName); + } + + @Override + public Observable getAsync(String locationName, String usageName) { + SubscriptionUsagesInner client = this.inner(); + return client.getAsync(locationName, usageName) + .map(new Func1() { + @Override + public SubscriptionUsage call(SubscriptionUsageInner inner) { + return wrapSubscriptionUsageModel(inner); + } + }); + } + + @Override + public Observable listByLocationAsync(final String locationName) { + SubscriptionUsagesInner 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 SubscriptionUsage call(SubscriptionUsageInner inner) { + return wrapSubscriptionUsageModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesInner.java new file mode 100644 index 0000000000000..90a446bff7e0c --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SubscriptionUsagesInner.java @@ -0,0 +1,386 @@ +/** + * 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.v2015_05_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 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 SubscriptionUsages. + */ +public class SubscriptionUsagesInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionUsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SubscriptionUsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionUsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SubscriptionUsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for SubscriptionUsages to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionUsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsages listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages") + Observable> listByLocation(@Path("locationName") String locationName, @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.v2015_05_01_preview.SubscriptionUsages get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}") + Observable> get(@Path("locationName") String locationName, @Path("usageName") String usageName, @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.v2015_05_01_preview.SubscriptionUsages listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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<SubscriptionUsageInner> 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(); + } + }; + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionUsageInner> object + */ + public Observable> listByLocationAsync(final String locationName) { + return listByLocationWithServiceResponseAsync(locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionUsageInner> 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)); + } + }); + } + + /** + * Gets all subscription usage metrics in a given location. + * + ServiceResponse> * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionUsageInner> 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."); + } + return service.listByLocation(locationName, 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 = 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 subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 SubscriptionUsageInner object if successful. + */ + public SubscriptionUsageInner get(String locationName, String usageName) { + return getWithServiceResponseAsync(locationName, usageName).toBlocking().single().body(); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 usageName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, usageName), serviceCallback); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionUsageInner object + */ + public Observable getAsync(String locationName, String usageName) { + return getWithServiceResponseAsync(locationName, usageName).map(new Func1, SubscriptionUsageInner>() { + @Override + public SubscriptionUsageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionUsageInner object + */ + public Observable> getWithServiceResponseAsync(String locationName, String usageName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (usageName == null) { + throw new IllegalArgumentException("Parameter usageName 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, usageName, 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 all subscription usage metrics 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<SubscriptionUsageInner> 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(); + } + }; + } + + /** + * Gets all subscription usage metrics 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); + } + + /** + * Gets all subscription usage metrics 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<SubscriptionUsageInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscription usage metrics 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<SubscriptionUsageInner> 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)); + } + }); + } + + /** + * Gets all subscription usage metrics 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<SubscriptionUsageInner> 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); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentImpl.java new file mode 100644 index 0000000000000..7fc599f62e5fa --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentImpl.java @@ -0,0 +1,131 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgent; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgentState; + +class SyncAgentImpl extends CreatableUpdatableImpl implements SyncAgent, SyncAgent.Definition, SyncAgent.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String syncAgentName; + + SyncAgentImpl(String name, SqlManager manager) { + super(name, new SyncAgentInner()); + this.manager = manager; + // Set resource name + this.syncAgentName = name; + // + } + + SyncAgentImpl(SyncAgentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.syncAgentName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.syncAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncAgents"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SyncAgentsInner client = this.manager().inner().syncAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.syncAgentName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SyncAgentsInner client = this.manager().inner().syncAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.syncAgentName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SyncAgentsInner client = this.manager().inner().syncAgents(); + return client.getAsync(this.resourceGroupName, this.serverName, this.syncAgentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime expiryTime() { + return this.inner().expiryTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isUpToDate() { + return this.inner().isUpToDate(); + } + + @Override + public DateTime lastAliveTime() { + return this.inner().lastAliveTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SyncAgentState state() { + return this.inner().state(); + } + + @Override + public String syncAgentName() { + return this.inner().syncAgentName(); + } + + @Override + public String syncDatabaseId() { + return this.inner().syncDatabaseId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String version() { + return this.inner().version(); + } + + @Override + public SyncAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentInner.java new file mode 100644 index 0000000000000..f09d30b78517d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentInner.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.v2015_05_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync agent. + */ +@JsonFlatten +public class SyncAgentInner extends ProxyResource { + /** + * Name of the sync agent. + */ + @JsonProperty(value = "properties.name", access = JsonProperty.Access.WRITE_ONLY) + private String syncAgentName; + + /** + * ARM resource id of the sync database in the sync agent. + */ + @JsonProperty(value = "properties.syncDatabaseId") + private String syncDatabaseId; + + /** + * Last alive time of the sync agent. + */ + @JsonProperty(value = "properties.lastAliveTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastAliveTime; + + /** + * State of the sync agent. Possible values include: 'Online', 'Offline', + * 'NeverConnected'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private SyncAgentState state; + + /** + * If the sync agent version is up to date. + */ + @JsonProperty(value = "properties.isUpToDate", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUpToDate; + + /** + * Expiration time of the sync agent version. + */ + @JsonProperty(value = "properties.expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiryTime; + + /** + * Version of the sync agent. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get name of the sync agent. + * + * @return the syncAgentName value + */ + public String syncAgentName() { + return this.syncAgentName; + } + + /** + * Get aRM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set aRM resource id of the sync database in the sync agent. + * + * @param syncDatabaseId the syncDatabaseId value to set + * @return the SyncAgentInner object itself. + */ + public SyncAgentInner withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get last alive time of the sync agent. + * + * @return the lastAliveTime value + */ + public DateTime lastAliveTime() { + return this.lastAliveTime; + } + + /** + * Get state of the sync agent. Possible values include: 'Online', 'Offline', 'NeverConnected'. + * + * @return the state value + */ + public SyncAgentState state() { + return this.state; + } + + /** + * Get if the sync agent version is up to date. + * + * @return the isUpToDate value + */ + public Boolean isUpToDate() { + return this.isUpToDate; + } + + /** + * Get expiration time of the sync agent version. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get version of the sync agent. + * + * @return the version value + */ + public String version() { + return this.version; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesImpl.java new file mode 100644 index 0000000000000..a0fd57673d458 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesImpl.java @@ -0,0 +1,31 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgentKeyProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class SyncAgentKeyPropertiesImpl extends WrapperImpl implements SyncAgentKeyProperties { + private final SqlManager manager; + SyncAgentKeyPropertiesImpl(SyncAgentKeyPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String syncAgentKey() { + return this.inner().syncAgentKey(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesInner.java new file mode 100644 index 0000000000000..eaab5bf27693b --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentKeyPropertiesInner.java @@ -0,0 +1,32 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an Azure SQL Database sync agent key. + */ +public class SyncAgentKeyPropertiesInner { + /** + * Key of sync agent. + */ + @JsonProperty(value = "syncAgentKey", access = JsonProperty.Access.WRITE_ONLY) + private String syncAgentKey; + + /** + * Get key of sync agent. + * + * @return the syncAgentKey value + */ + public String syncAgentKey() { + return this.syncAgentKey; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseImpl.java new file mode 100644 index 0000000000000..0c4d9535c4c7f --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgentLinkedDatabase; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberDbType; + +class SyncAgentLinkedDatabaseImpl extends WrapperImpl implements SyncAgentLinkedDatabase { + private final SqlManager manager; + + SyncAgentLinkedDatabaseImpl(SyncAgentLinkedDatabaseInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String databaseId() { + return this.inner().databaseId(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public SyncMemberDbType databaseType() { + return this.inner().databaseType(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userName() { + return this.inner().userName(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseInner.java new file mode 100644 index 0000000000000..ea4ab9e80a5c7 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentLinkedDatabaseInner.java @@ -0,0 +1,112 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberDbType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync agent linked database. + */ +@JsonFlatten +public class SyncAgentLinkedDatabaseInner extends ProxyResource { + /** + * Type of the sync agent linked database. Possible values include: + * 'AzureSqlDatabase', 'SqlServerDatabase'. + */ + @JsonProperty(value = "properties.databaseType", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberDbType databaseType; + + /** + * Id of the sync agent linked database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private String databaseId; + + /** + * Description of the sync agent linked database. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Server name of the sync agent linked database. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * Database name of the sync agent linked database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * User name of the sync agent linked database. + */ + @JsonProperty(value = "properties.userName", access = JsonProperty.Access.WRITE_ONLY) + private String userName; + + /** + * Get type of the sync agent linked database. Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase'. + * + * @return the databaseType value + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Get id of the sync agent linked database. + * + * @return the databaseId value + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Get description of the sync agent linked database. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get server name of the sync agent linked database. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get database name of the sync agent linked database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get user name of the sync agent linked database. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.java new file mode 100644 index 0000000000000..c3d7963df52ae --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgents; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgentKeyProperties; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgent; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgentLinkedDatabase; + +class SyncAgentsImpl extends WrapperImpl implements SyncAgents { + private final SqlManager manager; + + SyncAgentsImpl(SqlManager manager) { + super(manager.inner().syncAgents()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SyncAgentImpl define(String name) { + return wrapModel(name); + } + + private SyncAgentImpl wrapModel(SyncAgentInner inner) { + return new SyncAgentImpl(inner, manager()); + } + + private SyncAgentImpl wrapModel(String name) { + return new SyncAgentImpl(name, this.manager()); + } + + @Override + public Observable generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.generateKeyAsync(resourceGroupName, serverName, syncAgentName) + .map(new Func1() { + @Override + public SyncAgentKeyProperties call(SyncAgentKeyPropertiesInner inner) { + return new SyncAgentKeyPropertiesImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + SyncAgentsInner 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 SyncAgent call(SyncAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, syncAgentName) + .map(new Func1() { + @Override + public SyncAgent call(SyncAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, syncAgentName).toCompletable(); + } + + private SyncAgentLinkedDatabaseImpl wrapSyncAgentLinkedDatabaseModel(SyncAgentLinkedDatabaseInner inner) { + return new SyncAgentLinkedDatabaseImpl(inner, manager()); + } + + @Override + public Observable listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.listLinkedDatabasesAsync(resourceGroupName, serverName, syncAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncAgentLinkedDatabase call(SyncAgentLinkedDatabaseInner inner) { + return wrapSyncAgentLinkedDatabaseModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java new file mode 100644 index 0000000000000..d7b91d92037b4 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java @@ -0,0 +1,1287 @@ +/** + * 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.v2015_05_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 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 SyncAgents. + */ +public class SyncAgentsInner { + /** The Retrofit service to perform REST calls. */ + private SyncAgentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncAgentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SyncAgentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SyncAgentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SyncAgents to be + * used by Retrofit to perform actually REST calls. + */ + interface SyncAgentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgents get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v2015_05_01_preview.SyncAgents createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SyncAgentInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgents beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SyncAgentInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.SyncAgents delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v2015_05_01_preview.SyncAgents beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v2015_05_01_preview.SyncAgents listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents") + 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.v2015_05_01_preview.SyncAgents generateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/generateKey") + Observable> generateKey(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v2015_05_01_preview.SyncAgents listLinkedDatabases" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/linkedDatabases") + Observable> listLinkedDatabases(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v2015_05_01_preview.SyncAgents listByServerNext" }) + @GET + Observable> listByServerNext(@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.v2015_05_01_preview.SyncAgents listLinkedDatabasesNext" }) + @GET + Observable> listLinkedDatabasesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner get(String resourceGroupName, String serverName, String syncAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String syncAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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, syncAgentName, 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 sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner createOrUpdate(String resourceGroupName, String serverName, String syncAgentName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().last().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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 syncDatabaseId = null; + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(null); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner createOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().last().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 syncAgentName, String syncDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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."); + } + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(syncDatabaseId); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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 syncDatabaseId = null; + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(null); + return service.beginCreateOrUpdate(resourceGroupName, serverName, syncAgentName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().single().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 syncAgentName, String syncDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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."); + } + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(syncDatabaseId); + return service.beginCreateOrUpdate(resourceGroupName, serverName, syncAgentName, 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 = 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 sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().last().body(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String syncAgentName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String syncAgentName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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, syncAgentName, 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); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @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<SyncAgentInner> 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(); + } + }; + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @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); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentInner> 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(); + } + }); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentInner> 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)); + } + }); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncAgentInner> 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); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentKeyPropertiesInner object if successful. + */ + public SyncAgentKeyPropertiesInner generateKey(String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentKeyPropertiesInner object + */ + public Observable generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentKeyPropertiesInner>() { + @Override + public SyncAgentKeyPropertiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentKeyPropertiesInner object + */ + public Observable> generateKeyWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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.generateKey(resourceGroupName, serverName, syncAgentName, 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 = generateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateKeyDelegate(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); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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<SyncAgentLinkedDatabaseInner> object if successful. + */ + public PagedList listLinkedDatabases(final String resourceGroupName, final String serverName, final String syncAgentName) { + ServiceResponse> response = listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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> listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentLinkedDatabaseInner> object + */ + public Observable> listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + return listLinkedDatabasesWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentLinkedDatabaseInner> object + */ + public Observable>> listLinkedDatabasesWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + return listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName) + .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(listLinkedDatabasesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + 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 on which the sync agent is hosted. + ServiceResponse> * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncAgentLinkedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLinkedDatabasesSinglePageAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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.listLinkedDatabases(resourceGroupName, serverName, syncAgentName, 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 = listLinkedDatabasesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLinkedDatabasesDelegate(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 sync agents in 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<SyncAgentInner> 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(); + } + }; + } + + /** + * Lists sync agents in 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); + } + + /** + * Lists sync agents in 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<SyncAgentInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync agents in 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<SyncAgentInner> 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)); + } + }); + } + + /** + * Lists sync agents in 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<SyncAgentInner> 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); + } + + /** + * Lists databases linked to a sync agent. + * + * @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<SyncAgentLinkedDatabaseInner> object if successful. + */ + public PagedList listLinkedDatabasesNext(final String nextPageLink) { + ServiceResponse> response = listLinkedDatabasesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists databases linked to a sync agent. + * + * @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> listLinkedDatabasesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLinkedDatabasesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists databases linked to a sync agent. + * + * @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<SyncAgentLinkedDatabaseInner> object + */ + public Observable> listLinkedDatabasesNextAsync(final String nextPageLink) { + return listLinkedDatabasesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + * @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<SyncAgentLinkedDatabaseInner> object + */ + public Observable>> listLinkedDatabasesNextWithServiceResponseAsync(final String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(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(listLinkedDatabasesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncAgentLinkedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLinkedDatabasesNextSinglePageAsync(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.listLinkedDatabasesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLinkedDatabasesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLinkedDatabasesNextDelegate(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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesImpl.java new file mode 100644 index 0000000000000..29e07b01706b2 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesImpl.java @@ -0,0 +1,35 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncDatabaseIdProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class SyncDatabaseIdPropertiesImpl extends WrapperImpl implements SyncDatabaseIdProperties { + private final SqlManager manager; + + SyncDatabaseIdPropertiesImpl(SyncDatabaseIdPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesInner.java new file mode 100644 index 0000000000000..ab21395832211 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncDatabaseIdPropertiesInner.java @@ -0,0 +1,32 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the sync database id. + */ +public class SyncDatabaseIdPropertiesInner { + /** + * ARM resource id of sync database. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get aRM resource id of sync database. + * + * @return the id value + */ + public String id() { + return this.id; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncFullSchemaPropertiesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncFullSchemaPropertiesInner.java new file mode 100644 index 0000000000000..778e7b83fbfe6 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncFullSchemaPropertiesInner.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.v2015_05_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncFullSchemaTable; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the database full schema. + */ +public class SyncFullSchemaPropertiesInner { + /** + * List of tables in the database full schema. + */ + @JsonProperty(value = "tables", access = JsonProperty.Access.WRITE_ONLY) + private List tables; + + /** + * Last update time of the database schema. + */ + @JsonProperty(value = "lastUpdateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdateTime; + + /** + * Get list of tables in the database full schema. + * + * @return the tables value + */ + public List tables() { + return this.tables; + } + + /** + * Get last update time of the database schema. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java new file mode 100644 index 0000000000000..6425895827c3d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncFullSchemaTable; + +class SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl extends WrapperImpl implements SyncGroupDatabasisServerSyncFullSchemaProperties { + private final SqlManager manager; + + SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(SyncFullSchemaPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime lastUpdateTime() { + return this.inner().lastUpdateTime(); + } + + @Override + public List tables() { + return this.inner().tables(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupImpl.java new file mode 100644 index 0000000000000..62dc3b22678ef --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupImpl.java @@ -0,0 +1,177 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncConflictResolutionPolicy; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupState; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupSchema; + +class SyncGroupImpl extends CreatableUpdatableImpl implements SyncGroup, SyncGroup.Definition, SyncGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String syncGroupName; + + SyncGroupImpl(String name, SqlManager manager) { + super(name, new SyncGroupInner()); + this.manager = manager; + // Set resource name + this.syncGroupName = name; + // + } + + SyncGroupImpl(SyncGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.syncGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.syncGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncGroups"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SyncGroupsInner client = this.manager().inner().syncGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SyncGroupsInner client = this.manager().inner().syncGroups(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SyncGroupsInner client = this.manager().inner().syncGroups(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.inner().conflictResolutionPolicy(); + } + + @Override + public String hubDatabasePassword() { + return this.inner().hubDatabasePassword(); + } + + @Override + public String hubDatabaseUserName() { + return this.inner().hubDatabaseUserName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer interval() { + return this.inner().interval(); + } + + @Override + public DateTime lastSyncTime() { + return this.inner().lastSyncTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SyncGroupSchema schema() { + return this.inner().schema(); + } + + @Override + public String syncDatabaseId() { + return this.inner().syncDatabaseId(); + } + + @Override + public SyncGroupState syncState() { + return this.inner().syncState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SyncGroupImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public SyncGroupImpl withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.inner().withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + @Override + public SyncGroupImpl withHubDatabasePassword(String hubDatabasePassword) { + this.inner().withHubDatabasePassword(hubDatabasePassword); + return this; + } + + @Override + public SyncGroupImpl withHubDatabaseUserName(String hubDatabaseUserName) { + this.inner().withHubDatabaseUserName(hubDatabaseUserName); + return this; + } + + @Override + public SyncGroupImpl withInterval(Integer interval) { + this.inner().withInterval(interval); + return this; + } + + @Override + public SyncGroupImpl withSchema(SyncGroupSchema schema) { + this.inner().withSchema(schema); + return this; + } + + @Override + public SyncGroupImpl withSyncDatabaseId(String syncDatabaseId) { + this.inner().withSyncDatabaseId(syncDatabaseId); + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupInner.java new file mode 100644 index 0000000000000..13dffd53ec2d0 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupInner.java @@ -0,0 +1,212 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncConflictResolutionPolicy; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupState; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupSchema; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync group. + */ +@JsonFlatten +public class SyncGroupInner extends ProxyResource { + /** + * Sync interval of the sync group. + */ + @JsonProperty(value = "properties.interval") + private Integer interval; + + /** + * Last sync time of the sync group. + */ + @JsonProperty(value = "properties.lastSyncTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastSyncTime; + + /** + * Conflict resolution policy of the sync group. Possible values include: + * 'HubWin', 'MemberWin'. + */ + @JsonProperty(value = "properties.conflictResolutionPolicy") + private SyncConflictResolutionPolicy conflictResolutionPolicy; + + /** + * ARM resource id of the sync database in the sync group. + */ + @JsonProperty(value = "properties.syncDatabaseId") + private String syncDatabaseId; + + /** + * User name for the sync group hub database credential. + */ + @JsonProperty(value = "properties.hubDatabaseUserName") + private String hubDatabaseUserName; + + /** + * Password for the sync group hub database credential. + */ + @JsonProperty(value = "properties.hubDatabasePassword") + private String hubDatabasePassword; + + /** + * Sync state of the sync group. Possible values include: 'NotReady', + * 'Error', 'Warning', 'Progressing', 'Good'. + */ + @JsonProperty(value = "properties.syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupState syncState; + + /** + * Sync schema of the sync group. + */ + @JsonProperty(value = "properties.schema") + private SyncGroupSchema schema; + + /** + * Get sync interval of the sync group. + * + * @return the interval value + */ + public Integer interval() { + return this.interval; + } + + /** + * Set sync interval of the sync group. + * + * @param interval the interval value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Get last sync time of the sync group. + * + * @return the lastSyncTime value + */ + public DateTime lastSyncTime() { + return this.lastSyncTime; + } + + /** + * Get conflict resolution policy of the sync group. Possible values include: 'HubWin', 'MemberWin'. + * + * @return the conflictResolutionPolicy value + */ + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set conflict resolution policy of the sync group. Possible values include: 'HubWin', 'MemberWin'. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get aRM resource id of the sync database in the sync group. + * + * @return the syncDatabaseId value + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set aRM resource id of the sync database in the sync group. + * + * @param syncDatabaseId the syncDatabaseId value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get user name for the sync group hub database credential. + * + * @return the hubDatabaseUserName value + */ + public String hubDatabaseUserName() { + return this.hubDatabaseUserName; + } + + /** + * Set user name for the sync group hub database credential. + * + * @param hubDatabaseUserName the hubDatabaseUserName value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withHubDatabaseUserName(String hubDatabaseUserName) { + this.hubDatabaseUserName = hubDatabaseUserName; + return this; + } + + /** + * Get password for the sync group hub database credential. + * + * @return the hubDatabasePassword value + */ + public String hubDatabasePassword() { + return this.hubDatabasePassword; + } + + /** + * Set password for the sync group hub database credential. + * + * @param hubDatabasePassword the hubDatabasePassword value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withHubDatabasePassword(String hubDatabasePassword) { + this.hubDatabasePassword = hubDatabasePassword; + return this; + } + + /** + * Get sync state of the sync group. Possible values include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good'. + * + * @return the syncState value + */ + public SyncGroupState syncState() { + return this.syncState; + } + + /** + * Get sync schema of the sync group. + * + * @return the schema value + */ + public SyncGroupSchema schema() { + return this.schema; + } + + /** + * Set sync schema of the sync group. + * + * @param schema the schema value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSchema(SyncGroupSchema schema) { + this.schema = schema; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesImpl.java new file mode 100644 index 0000000000000..965f1f51c1feb --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupLogProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupLogType; + +class SyncGroupLogPropertiesImpl extends WrapperImpl implements SyncGroupLogProperties { + private final SqlManager manager; + + SyncGroupLogPropertiesImpl(SyncGroupLogPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String details() { + return this.inner().details(); + } + + @Override + public String operationStatus() { + return this.inner().operationStatus(); + } + + @Override + public String source() { + return this.inner().source(); + } + + @Override + public DateTime timestamp() { + return this.inner().timestamp(); + } + + @Override + public UUID tracingId() { + return this.inner().tracingId(); + } + + @Override + public SyncGroupLogType type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesInner.java new file mode 100644 index 0000000000000..f0885f6c82ad8 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupLogPropertiesInner.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.v2015_05_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupLogType; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an Azure SQL Database sync group log. + */ +public class SyncGroupLogPropertiesInner { + /** + * Timestamp of the sync group log. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * Type of the sync group log. Possible values include: 'All', 'Error', + * 'Warning', 'Success'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupLogType type; + + /** + * Source of the sync group log. + */ + @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) + private String source; + + /** + * Details of the sync group log. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private String details; + + /** + * TracingId of the sync group log. + */ + @JsonProperty(value = "tracingId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tracingId; + + /** + * OperationStatus of the sync group log. + */ + @JsonProperty(value = "operationStatus", access = JsonProperty.Access.WRITE_ONLY) + private String operationStatus; + + /** + * Get timestamp of the sync group log. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get type of the sync group log. Possible values include: 'All', 'Error', 'Warning', 'Success'. + * + * @return the type value + */ + public SyncGroupLogType type() { + return this.type; + } + + /** + * Get source of the sync group log. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Get details of the sync group log. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Get tracingId of the sync group log. + * + * @return the tracingId value + */ + public UUID tracingId() { + return this.tracingId; + } + + /** + * Get operationStatus of the sync group log. + * + * @return the operationStatus value + */ + public String operationStatus() { + return this.operationStatus; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.java new file mode 100644 index 0000000000000..e9f0237332594 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroup; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncDatabaseIdProperties; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroupLogProperties; + +class SyncGroupsImpl extends WrapperImpl implements SyncGroups { + private final SqlManager manager; + + SyncGroupsImpl(SqlManager manager) { + super(manager.inner().syncGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SyncGroupImpl define(String name) { + return wrapModel(name); + } + + private SyncGroupImpl wrapModel(SyncGroupInner inner) { + return new SyncGroupImpl(inner, manager()); + } + + private SyncGroupImpl wrapModel(String name) { + return new SyncGroupImpl(name, this.manager()); + } + + @Override + public Completable refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.refreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + @Override + public Completable cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.cancelSyncAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + @Override + public Completable triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.triggerSyncAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + SyncGroupsInner 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 SyncGroup call(SyncGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .map(new Func1() { + @Override + public SyncGroup call(SyncGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + private SyncDatabaseIdPropertiesImpl wrapSyncDatabaseIdPropertiesModel(SyncDatabaseIdPropertiesInner inner) { + return new SyncDatabaseIdPropertiesImpl(inner, manager()); + } + + private SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl wrapSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(SyncFullSchemaPropertiesInner inner) { + return new SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(inner, manager()); + } + + private SyncGroupLogPropertiesImpl wrapSyncGroupLogPropertiesModel(SyncGroupLogPropertiesInner inner) { + return new SyncGroupLogPropertiesImpl(inner, manager()); + } + + @Override + public Observable listSyncDatabaseIdsAsync(final String locationName) { + SyncGroupsInner client = this.inner(); + return client.listSyncDatabaseIdsAsync(locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncDatabaseIdProperties call(SyncDatabaseIdPropertiesInner inner) { + return wrapSyncDatabaseIdPropertiesModel(inner); + } + }); + } + + @Override + public Observable listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.listHubSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncGroupDatabasisServerSyncFullSchemaProperties call(SyncFullSchemaPropertiesInner inner) { + return wrapSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(inner); + } + }); + } + + @Override + public Observable listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + SyncGroupsInner client = this.inner(); + return client.listLogsAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncGroupLogProperties call(SyncGroupLogPropertiesInner inner) { + return wrapSyncGroupLogPropertiesModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java new file mode 100644 index 0000000000000..0ff328dfc1476 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java @@ -0,0 +1,2362 @@ +/** + * 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.v2015_05_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.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 SyncGroups. + */ +public class SyncGroupsInner { + /** The Retrofit service to perform REST calls. */ + private SyncGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SyncGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SyncGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SyncGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface SyncGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroups listSyncDatabaseIds" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds") + Observable> listSyncDatabaseIds(@Path("locationName") String locationName, @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.v2015_05_01_preview.SyncGroups refreshHubSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema") + Observable> refreshHubSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups beginRefreshHubSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema") + Observable> beginRefreshHubSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups listHubSchemas" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas") + Observable> listHubSchemas(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups listLogs" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs") + Observable> listLogs(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Query("startTime") String startTime, @Query("endTime") String endTime, @Query("type") String type, @Query("continuationToken") String continuationToken, @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.v2015_05_01_preview.SyncGroups cancelSync" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync") + Observable> cancelSync(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups triggerSync" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync") + Observable> triggerSync(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v2015_05_01_preview.SyncGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v2015_05_01_preview.SyncGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v2015_05_01_preview.SyncGroups beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v2015_05_01_preview.SyncGroups listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups") + 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.v2015_05_01_preview.SyncGroups listSyncDatabaseIdsNext" }) + @GET + Observable> listSyncDatabaseIdsNext(@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.v2015_05_01_preview.SyncGroups listHubSchemasNext" }) + @GET + Observable> listHubSchemasNext(@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.v2015_05_01_preview.SyncGroups listLogsNext" }) + @GET + Observable> listLogsNext(@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.v2015_05_01_preview.SyncGroups listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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<SyncDatabaseIdPropertiesInner> object if successful. + */ + public PagedList listSyncDatabaseIds(final String locationName) { + ServiceResponse> response = listSyncDatabaseIdsSinglePageAsync(locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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> listSyncDatabaseIdsAsync(final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSyncDatabaseIdsSinglePageAsync(locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncDatabaseIdPropertiesInner> object + */ + public Observable> listSyncDatabaseIdsAsync(final String locationName) { + return listSyncDatabaseIdsWithServiceResponseAsync(locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncDatabaseIdPropertiesInner> object + */ + public Observable>> listSyncDatabaseIdsWithServiceResponseAsync(final String locationName) { + return listSyncDatabaseIdsSinglePageAsync(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(listSyncDatabaseIdsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + ServiceResponse> * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncDatabaseIdPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSyncDatabaseIdsSinglePageAsync(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."); + } + return service.listSyncDatabaseIds(locationName, 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 = listSyncDatabaseIdsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listSyncDatabaseIdsDelegate(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); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().last().body(); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> refreshHubSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 beginRefreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 beginRefreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRefreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRefreshHubSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.beginRefreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, 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 = beginRefreshHubSchemaDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRefreshHubSchemaDelegate(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 collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listHubSchemas(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + ServiceResponse> response = listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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> listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable> listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listHubSchemasWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listHubSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .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(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + 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 on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listHubSchemasSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.listHubSchemas(resourceGroupName, serverName, databaseName, syncGroupName, 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 = listHubSchemasDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listHubSchemasDelegate(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 collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @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<SyncGroupLogPropertiesInner> object if successful. + */ + public PagedList listLogs(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + ServiceResponse> response = listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @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> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + return listLogsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable>> listLogsWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + return listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type) + .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(listLogsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupLogPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLogsSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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 (startTime == null) { + throw new IllegalArgumentException("Parameter startTime is required and cannot be null."); + } + if (endTime == null) { + throw new IllegalArgumentException("Parameter endTime is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type 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 continuationToken = null; + return service.listLogs(resourceGroupName, serverName, databaseName, syncGroupName, this.client.subscriptionId(), startTime, endTime, type, continuationToken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLogsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this 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<SyncGroupLogPropertiesInner> object if successful. + */ + public PagedList listLogs(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + ServiceResponse> response = listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this operation. + * @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> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + return listLogsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable>> listLogsWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + return listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken) + .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(listLogsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + 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 on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group. + ServiceResponse> * @param startTime Get logs generated after this time. + ServiceResponse> * @param endTime Get logs generated before this time. + ServiceResponse> * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + ServiceResponse> * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupLogPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLogsSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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 (startTime == null) { + throw new IllegalArgumentException("Parameter startTime is required and cannot be null."); + } + if (endTime == null) { + throw new IllegalArgumentException("Parameter endTime is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type 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.listLogs(resourceGroupName, serverName, databaseName, syncGroupName, this.client.subscriptionId(), startTime, endTime, type, continuationToken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLogsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLogsDelegate(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); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelSyncWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.cancelSync(resourceGroupName, serverName, databaseName, syncGroupName, 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 = cancelSyncDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelSyncDelegate(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); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + triggerSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(triggerSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return triggerSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> triggerSyncWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.triggerSync(resourceGroupName, serverName, databaseName, syncGroupName, 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 = triggerSyncDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse triggerSyncDelegate(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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 SyncGroupInner object if successful. + */ + public SyncGroupInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().last().body(); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner update(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().last().body(); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, serverName, databaseName, syncGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner beginUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().single().body(); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, serverName, databaseName, syncGroupName, 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); + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @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<SyncGroupInner> 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(); + } + }; + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @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); + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupInner> 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(); + } + }); + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupInner> 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)); + } + }); + } + + /** + * Lists sync groups under a hub 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupInner> 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 collection of sync database ids. + * + * @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<SyncDatabaseIdPropertiesInner> object if successful. + */ + public PagedList listSyncDatabaseIdsNext(final String nextPageLink) { + ServiceResponse> response = listSyncDatabaseIdsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync database ids. + * + * @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> listSyncDatabaseIdsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSyncDatabaseIdsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync database ids. + * + * @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<SyncDatabaseIdPropertiesInner> object + */ + public Observable> listSyncDatabaseIdsNextAsync(final String nextPageLink) { + return listSyncDatabaseIdsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + * @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<SyncDatabaseIdPropertiesInner> object + */ + public Observable>> listSyncDatabaseIdsNextWithServiceResponseAsync(final String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(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(listSyncDatabaseIdsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncDatabaseIdPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSyncDatabaseIdsNextSinglePageAsync(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.listSyncDatabaseIdsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSyncDatabaseIdsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listSyncDatabaseIdsNextDelegate(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 collection of hub database schemas. + * + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listHubSchemasNext(final String nextPageLink) { + ServiceResponse> response = listHubSchemasNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of hub database schemas. + * + * @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> listHubSchemasNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listHubSchemasNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of hub database schemas. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable> listHubSchemasNextAsync(final String nextPageLink) { + return listHubSchemasNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listHubSchemasNextWithServiceResponseAsync(final String nextPageLink) { + return listHubSchemasNextSinglePageAsync(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(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listHubSchemasNextSinglePageAsync(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.listHubSchemasNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listHubSchemasNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listHubSchemasNextDelegate(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 collection of sync group logs. + * + * @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<SyncGroupLogPropertiesInner> object if successful. + */ + public PagedList listLogsNext(final String nextPageLink) { + ServiceResponse> response = listLogsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync group logs. + * + * @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> listLogsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLogsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync group logs. + * + * @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<SyncGroupLogPropertiesInner> object + */ + public Observable> listLogsNextAsync(final String nextPageLink) { + return listLogsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @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<SyncGroupLogPropertiesInner> object + */ + public Observable>> listLogsNextWithServiceResponseAsync(final String nextPageLink) { + return listLogsNextSinglePageAsync(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(listLogsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupLogPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLogsNextSinglePageAsync(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.listLogsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLogsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLogsNextDelegate(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 sync groups under a hub 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<SyncGroupInner> 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 sync groups under a hub 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 sync groups under a hub 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<SyncGroupInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync groups under a hub 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<SyncGroupInner> 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 sync groups under a hub 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<SyncGroupInner> 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberImpl.java new file mode 100644 index 0000000000000..d71775a311b04 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberImpl.java @@ -0,0 +1,197 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMember; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberDbType; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncDirection; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberState; + +class SyncMemberImpl extends CreatableUpdatableImpl implements SyncMember, SyncMember.Definition, SyncMember.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String syncGroupName; + private String syncMemberName; + + SyncMemberImpl(String name, SqlManager manager) { + super(name, new SyncMemberInner()); + this.manager = manager; + // Set resource name + this.syncMemberName = name; + // + } + + SyncMemberImpl(SyncMemberInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.syncMemberName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.syncGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncGroups"); + this.syncMemberName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncMembers"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SyncMembersInner client = this.manager().inner().syncMembers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.syncMemberName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SyncMembersInner client = this.manager().inner().syncMembers(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.syncMemberName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SyncMembersInner client = this.manager().inner().syncMembers(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.syncMemberName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public SyncMemberDbType databaseType() { + return this.inner().databaseType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String password() { + return this.inner().password(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public UUID sqlServerDatabaseId() { + return this.inner().sqlServerDatabaseId(); + } + + @Override + public String syncAgentId() { + return this.inner().syncAgentId(); + } + + @Override + public SyncDirection syncDirection() { + return this.inner().syncDirection(); + } + + @Override + public SyncMemberState syncState() { + return this.inner().syncState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userName() { + return this.inner().userName(); + } + + @Override + public SyncMemberImpl withExistingSyncGroup(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.syncGroupName = syncGroupName; + return this; + } + + @Override + public SyncMemberImpl withDatabaseName(String databaseName) { + this.inner().withDatabaseName(databaseName); + return this; + } + + @Override + public SyncMemberImpl withDatabaseType(SyncMemberDbType databaseType) { + this.inner().withDatabaseType(databaseType); + return this; + } + + @Override + public SyncMemberImpl withPassword(String password) { + this.inner().withPassword(password); + return this; + } + + @Override + public SyncMemberImpl withServerName(String serverName) { + this.inner().withServerName(serverName); + return this; + } + + @Override + public SyncMemberImpl withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.inner().withSqlServerDatabaseId(sqlServerDatabaseId); + return this; + } + + @Override + public SyncMemberImpl withSyncAgentId(String syncAgentId) { + this.inner().withSyncAgentId(syncAgentId); + return this; + } + + @Override + public SyncMemberImpl withSyncDirection(SyncDirection syncDirection) { + this.inner().withSyncDirection(syncDirection); + return this; + } + + @Override + public SyncMemberImpl withUserName(String userName) { + this.inner().withUserName(userName); + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberInner.java new file mode 100644 index 0000000000000..1901563cab837 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberInner.java @@ -0,0 +1,255 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberDbType; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncDirection; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync member. + */ +@JsonFlatten +public class SyncMemberInner extends ProxyResource { + /** + * Database type of the sync member. Possible values include: + * 'AzureSqlDatabase', 'SqlServerDatabase'. + */ + @JsonProperty(value = "properties.databaseType") + private SyncMemberDbType databaseType; + + /** + * ARM resource id of the sync agent in the sync member. + */ + @JsonProperty(value = "properties.syncAgentId") + private String syncAgentId; + + /** + * SQL Server database id of the sync member. + */ + @JsonProperty(value = "properties.sqlServerDatabaseId") + private UUID sqlServerDatabaseId; + + /** + * Server name of the member database in the sync member. + */ + @JsonProperty(value = "properties.serverName") + private String serverName; + + /** + * Database name of the member database in the sync member. + */ + @JsonProperty(value = "properties.databaseName") + private String databaseName; + + /** + * User name of the member database in the sync member. + */ + @JsonProperty(value = "properties.userName") + private String userName; + + /** + * Password of the member database in the sync member. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * Sync direction of the sync member. Possible values include: + * 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember'. + */ + @JsonProperty(value = "properties.syncDirection") + private SyncDirection syncDirection; + + /** + * Sync state of the sync member. Possible values include: + * 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', + * 'DisabledTombstoneCleanup', 'DisabledBackupRestore', + * 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', + * 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', + * 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', + * 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'. + */ + @JsonProperty(value = "properties.syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberState syncState; + + /** + * Get database type of the sync member. Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase'. + * + * @return the databaseType value + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Set database type of the sync member. Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase'. + * + * @param databaseType the databaseType value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withDatabaseType(SyncMemberDbType databaseType) { + this.databaseType = databaseType; + return this; + } + + /** + * Get aRM resource id of the sync agent in the sync member. + * + * @return the syncAgentId value + */ + public String syncAgentId() { + return this.syncAgentId; + } + + /** + * Set aRM resource id of the sync agent in the sync member. + * + * @param syncAgentId the syncAgentId value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncAgentId(String syncAgentId) { + this.syncAgentId = syncAgentId; + return this; + } + + /** + * Get sQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value + */ + public UUID sqlServerDatabaseId() { + return this.sqlServerDatabaseId; + } + + /** + * Set sQL Server database id of the sync member. + * + * @param sqlServerDatabaseId the sqlServerDatabaseId value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.sqlServerDatabaseId = sqlServerDatabaseId; + return this; + } + + /** + * Get server name of the member database in the sync member. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set server name of the member database in the sync member. + * + * @param serverName the serverName value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get database name of the member database in the sync member. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set database name of the member database in the sync member. + * + * @param databaseName the databaseName value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get user name of the member database in the sync member. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set user name of the member database in the sync member. + * + * @param userName the userName value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get password of the member database in the sync member. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set password of the member database in the sync member. + * + * @param password the password value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get sync direction of the sync member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember'. + * + * @return the syncDirection value + */ + public SyncDirection syncDirection() { + return this.syncDirection; + } + + /** + * Set sync direction of the sync member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember'. + * + * @param syncDirection the syncDirection value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncDirection(SyncDirection syncDirection) { + this.syncDirection = syncDirection; + return this; + } + + /** + * Get sync state of the sync member. Possible values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', 'DisabledTombstoneCleanup', 'DisabledBackupRestore', 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'. + * + * @return the syncState value + */ + public SyncMemberState syncState() { + return this.syncState; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java new file mode 100644 index 0000000000000..35d019a5095d8 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncFullSchemaTable; + +class SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl extends WrapperImpl implements SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties { + private final SqlManager manager; + + SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(SyncFullSchemaPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime lastUpdateTime() { + return this.inner().lastUpdateTime(); + } + + @Override + public List tables() { + return this.inner().tables(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.java new file mode 100644 index 0000000000000..03f240e06b4d0 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMembers; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMember; +import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties; + +class SyncMembersImpl extends WrapperImpl implements SyncMembers { + private final SqlManager manager; + + SyncMembersImpl(SqlManager manager) { + super(manager.inner().syncMembers()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SyncMemberImpl define(String name) { + return wrapModel(name); + } + + private SyncMemberImpl wrapModel(SyncMemberInner inner) { + return new SyncMemberImpl(inner, manager()); + } + + private SyncMemberImpl wrapModel(String name) { + return new SyncMemberImpl(name, this.manager()); + } + + @Override + public Completable refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.refreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toCompletable(); + } + + @Override + public Observable listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + SyncMembersInner client = this.inner(); + return client.listBySyncGroupAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncMember call(SyncMemberInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .map(new Func1() { + @Override + public SyncMember call(SyncMemberInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toCompletable(); + } + + private SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl wrapSyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(SyncFullSchemaPropertiesInner inner) { + return new SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(inner, manager()); + } + + @Override + public Observable listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.listMemberSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties call(SyncFullSchemaPropertiesInner inner) { + return wrapSyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java new file mode 100644 index 0000000000000..0ce2867eb2feb --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java @@ -0,0 +1,1557 @@ +/** + * 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.v2015_05_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.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 SyncMembers. + */ +public class SyncMembersInner { + /** The Retrofit service to perform REST calls. */ + private SyncMembersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncMembersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SyncMembersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SyncMembersService.class); + this.client = client; + } + + /** + * The interface defining all the services for SyncMembers to be + * used by Retrofit to perform actually REST calls. + */ + interface SyncMembersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMembers get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v2015_05_01_preview.SyncMembers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v2015_05_01_preview.SyncMembers beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v2015_05_01_preview.SyncMembers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v2015_05_01_preview.SyncMembers beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v2015_05_01_preview.SyncMembers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v2015_05_01_preview.SyncMembers beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v2015_05_01_preview.SyncMembers listBySyncGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers") + Observable> listBySyncGroup(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v2015_05_01_preview.SyncMembers listMemberSchemas" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/schemas") + Observable> listMemberSchemas(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v2015_05_01_preview.SyncMembers refreshMemberSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema") + Observable> refreshMemberSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v2015_05_01_preview.SyncMembers beginRefreshMemberSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema") + Observable> beginRefreshMemberSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v2015_05_01_preview.SyncMembers listBySyncGroupNext" }) + @GET + Observable> listBySyncGroupNext(@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.v2015_05_01_preview.SyncMembers listMemberSchemasNext" }) + @GET + Observable> listMemberSchemasNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 SyncMemberInner object if successful. + */ + public SyncMemberInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single().body(); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().last().body(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single().body(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner update(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, serverName, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner beginUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, serverName, databaseName, syncGroupName, syncMemberName, 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); + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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<SyncMemberInner> object if successful. + */ + public PagedList listBySyncGroup(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + ServiceResponse> response = listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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> listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncMemberInner> object + */ + public Observable> listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listBySyncGroupWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncMemberInner> object + */ + public Observable>> listBySyncGroupWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .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(listBySyncGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists sync members in the given sync 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. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncMemberInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySyncGroupSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.listBySyncGroup(resourceGroupName, serverName, databaseName, syncGroupName, 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 = listBySyncGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySyncGroupDelegate(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 sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listMemberSchemas(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + ServiceResponse> response = listMemberSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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> listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listMemberSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable> listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + return listMemberSchemasWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listMemberSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + return listMemberSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .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(listMemberSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a sync member database schema. + * + 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 on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group on which the sync member is hosted. + ServiceResponse> * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listMemberSchemasSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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.listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, 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 = listMemberSchemasDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMemberSchemasDelegate(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); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 refreshMemberSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().last().body(); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> refreshMemberSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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.refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 beginRefreshMemberSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single().body(); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 beginRefreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRefreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRefreshMemberSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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.beginRefreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, 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 = beginRefreshMemberSchemaDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRefreshMemberSchemaDelegate(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 sync members in the given sync 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<SyncMemberInner> object if successful. + */ + public PagedList listBySyncGroupNext(final String nextPageLink) { + ServiceResponse> response = listBySyncGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists sync members in the given sync 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> listBySyncGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySyncGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists sync members in the given sync 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<SyncMemberInner> object + */ + public Observable> listBySyncGroupNextAsync(final String nextPageLink) { + return listBySyncGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync members in the given sync 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<SyncMemberInner> object + */ + public Observable>> listBySyncGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(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(listBySyncGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists sync members in the given sync 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<SyncMemberInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySyncGroupNextSinglePageAsync(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.listBySyncGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySyncGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySyncGroupNextDelegate(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 sync member database schema. + * + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listMemberSchemasNext(final String nextPageLink) { + ServiceResponse> response = listMemberSchemasNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a sync member database schema. + * + * @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> listMemberSchemasNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listMemberSchemasNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a sync member database schema. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable> listMemberSchemasNextAsync(final String nextPageLink) { + return listMemberSchemasNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a sync member database schema. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listMemberSchemasNextWithServiceResponseAsync(final String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(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(listMemberSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a sync member database schema. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listMemberSchemasNextSinglePageAsync(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.listMemberSchemasNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMemberSchemasNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMemberSchemasNextDelegate(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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 0000000000000..a02db923d69c6 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleImpl.java @@ -0,0 +1,122 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRuleState; + +class VirtualNetworkRuleImpl extends CreatableUpdatableImpl implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String virtualNetworkRuleName; + + VirtualNetworkRuleImpl(String name, SqlManager manager) { + super(name, new VirtualNetworkRuleInner()); + this.manager = manager; + // Set resource name + this.virtualNetworkRuleName = name; + // + } + + VirtualNetworkRuleImpl(VirtualNetworkRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.virtualNetworkRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.virtualNetworkRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualNetworkRules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualNetworkRulesInner client = this.manager().inner().virtualNetworkRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.virtualNetworkRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualNetworkRulesInner client = this.manager().inner().virtualNetworkRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.virtualNetworkRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualNetworkRulesInner client = this.manager().inner().virtualNetworkRules(); + return client.getAsync(this.resourceGroupName, this.serverName, this.virtualNetworkRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.inner().ignoreMissingVnetServiceEndpoint(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public VirtualNetworkRuleState state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String virtualNetworkSubnetId() { + return this.inner().virtualNetworkSubnetId(); + } + + @Override + public VirtualNetworkRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public VirtualNetworkRuleImpl withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.inner().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + @Override + public VirtualNetworkRuleImpl withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.inner().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleInner.java new file mode 100644 index 0000000000000..45fcf190e1c3e --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRuleInner.java @@ -0,0 +1,90 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A virtual network rule. + */ +@JsonFlatten +public class VirtualNetworkRuleInner extends ProxyResource { + /** + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "properties.virtualNetworkSubnetId", required = true) + private String virtualNetworkSubnetId; + + /** + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "properties.ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Virtual Network Rule State. Possible values include: 'Initializing', + * 'InProgress', 'Ready', 'Deleting', 'Unknown'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** + * Get the ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get virtual Network Rule State. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown'. + * + * @return the state value + */ + public VirtualNetworkRuleState state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 0000000000000..c21ddff53626d --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRule; + +class VirtualNetworkRulesImpl extends WrapperImpl implements VirtualNetworkRules { + private final SqlManager manager; + + VirtualNetworkRulesImpl(SqlManager manager) { + super(manager.inner().virtualNetworkRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public VirtualNetworkRuleImpl define(String name) { + return wrapModel(name); + } + + private VirtualNetworkRuleImpl wrapModel(VirtualNetworkRuleInner inner) { + return new VirtualNetworkRuleImpl(inner, manager()); + } + + private VirtualNetworkRuleImpl wrapModel(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + VirtualNetworkRulesInner 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 VirtualNetworkRule call(VirtualNetworkRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRulesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .map(new Func1() { + @Override + public VirtualNetworkRule call(VirtualNetworkRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesInner.java new file mode 100644 index 0000000000000..b397ac6eceb90 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesInner.java @@ -0,0 +1,777 @@ +/** + * 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.v2015_05_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 VirtualNetworkRules. + */ +public class VirtualNetworkRulesInner { + /** The Retrofit service to perform REST calls. */ + private VirtualNetworkRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualNetworkRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(VirtualNetworkRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualNetworkRules to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualNetworkRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.v2015_05_01_preview.VirtualNetworkRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Path("subscriptionId") String subscriptionId, @Body VirtualNetworkRuleInner 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.v2015_05_01_preview.VirtualNetworkRules beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Path("subscriptionId") String subscriptionId, @Body VirtualNetworkRuleInner 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.v2015_05_01_preview.VirtualNetworkRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.v2015_05_01_preview.VirtualNetworkRules beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.v2015_05_01_preview.VirtualNetworkRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules") + 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.v2015_05_01_preview.VirtualNetworkRules listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner beginCreateOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().last().body(); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/package-info.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..5d6d641e5a6de --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2015_05_01_preview.implementation; diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/package-info.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/package-info.java new file mode 100644 index 0000000000000..06c901d97dff5 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2015_05_01_preview; diff --git a/sql/resource-manager/v2017_03_01_preview/pom.xml b/sql/resource-manager/v2017_03_01_preview/pom.xml new file mode 100644 index 0000000000000..55c39774959be --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v2017_03_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeActual.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeActual.java new file mode 100644 index 0000000000000..13bc9980113f9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeActual.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeActual. + */ +public enum AutomaticTuningOptionModeActual { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"); + + /** The actual serialized value for a AutomaticTuningOptionModeActual instance. */ + private String value; + + AutomaticTuningOptionModeActual(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeActual instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeActual object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeActual fromString(String value) { + AutomaticTuningOptionModeActual[] items = AutomaticTuningOptionModeActual.values(); + for (AutomaticTuningOptionModeActual item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeDesired.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeDesired.java new file mode 100644 index 0000000000000..2cc3d88b0b615 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningOptionModeDesired.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeDesired. + */ +public enum AutomaticTuningOptionModeDesired { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutomaticTuningOptionModeDesired instance. */ + private String value; + + AutomaticTuningOptionModeDesired(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeDesired instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeDesired object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeDesired fromString(String value) { + AutomaticTuningOptionModeDesired[] items = AutomaticTuningOptionModeDesired.values(); + for (AutomaticTuningOptionModeDesired item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerMode.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerMode.java new file mode 100644 index 0000000000000..6747392c31579 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerMode.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningServerMode. + */ +public enum AutomaticTuningServerMode { + /** Enum value Custom. */ + CUSTOM("Custom"), + + /** Enum value Auto. */ + AUTO("Auto"), + + /** Enum value Unspecified. */ + UNSPECIFIED("Unspecified"); + + /** The actual serialized value for a AutomaticTuningServerMode instance. */ + private String value; + + AutomaticTuningServerMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningServerMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningServerMode object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningServerMode fromString(String value) { + AutomaticTuningServerMode[] items = AutomaticTuningServerMode.values(); + for (AutomaticTuningServerMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerOptions.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerOptions.java new file mode 100644 index 0000000000000..c7a846f389925 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerOptions.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Automatic tuning properties for individual advisors. + */ +public class AutomaticTuningServerOptions { + /** + * Automatic tuning option desired state. Possible values include: 'Off', + * 'On', 'Default'. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /** + * Automatic tuning option actual state. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningOptionModeActual actualState; + + /** + * Reason code if desired and actual state are different. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer reasonCode; + + /** + * Reason description if desired and actual state are different. Possible + * values include: 'Default', 'Disabled', 'AutoConfigured'. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerReason reasonDesc; + + /** + * Get automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @return the desiredState value + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @param desiredState the desiredState value to set + * @return the AutomaticTuningServerOptions object itself. + */ + public AutomaticTuningServerOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning option actual state. Possible values include: 'Off', 'On'. + * + * @return the actualState value + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get reason code if desired and actual state are different. + * + * @return the reasonCode value + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get reason description if desired and actual state are different. Possible values include: 'Default', 'Disabled', 'AutoConfigured'. + * + * @return the reasonDesc value + */ + public AutomaticTuningServerReason reasonDesc() { + return this.reasonDesc; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerReason.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerReason.java new file mode 100644 index 0000000000000..939c30c822462 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/AutomaticTuningServerReason.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningServerReason. + */ +public enum AutomaticTuningServerReason { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value AutoConfigured. */ + AUTO_CONFIGURED("AutoConfigured"); + + /** The actual serialized value for a AutomaticTuningServerReason instance. */ + private String value; + + AutomaticTuningServerReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningServerReason instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningServerReason object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningServerReason fromString(String value) { + AutomaticTuningServerReason[] items = AutomaticTuningServerReason.values(); + for (AutomaticTuningServerReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicies.java new file mode 100644 index 0000000000000..2b3348d93637f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicies.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.BackupLongTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BackupLongTermRetentionPolicies. + */ +public interface BackupLongTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicy.java new file mode 100644 index 0000000000000..d52ff3f6e0837 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BackupLongTermRetentionPolicy.java @@ -0,0 +1,185 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.BackupLongTermRetentionPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing BackupLongTermRetentionPolicy. + */ +public interface BackupLongTermRetentionPolicy 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 BackupLongTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackupLongTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackupLongTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify MonthlyRetention. + */ + interface WithMonthlyRetention { + /** + * Specifies monthlyRetention. + */ + WithCreate withMonthlyRetention(String monthlyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify WeeklyRetention. + */ + interface WithWeeklyRetention { + /** + * Specifies weeklyRetention. + */ + WithCreate withWeeklyRetention(String weeklyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify WeekOfYear. + */ + interface WithWeekOfYear { + /** + * Specifies weekOfYear. + */ + WithCreate withWeekOfYear(Integer weekOfYear); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify YearlyRetention. + */ + interface WithYearlyRetention { + /** + * Specifies yearlyRetention. + */ + 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 BackupLongTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithMonthlyRetention, UpdateStages.WithWeeklyRetention, UpdateStages.WithWeekOfYear, UpdateStages.WithYearlyRetention { + } + + /** + * Grouping of BackupLongTermRetentionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify MonthlyRetention. + */ + interface WithMonthlyRetention { + /** + * Specifies monthlyRetention. + */ + Update withMonthlyRetention(String monthlyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify WeeklyRetention. + */ + interface WithWeeklyRetention { + /** + * Specifies weeklyRetention. + */ + Update withWeeklyRetention(String weeklyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify WeekOfYear. + */ + interface WithWeekOfYear { + /** + * Specifies weekOfYear. + */ + Update withWeekOfYear(Integer weekOfYear); + } + + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify YearlyRetention. + */ + interface WithYearlyRetention { + /** + * Specifies yearlyRetention. + */ + Update withYearlyRetention(String yearlyRetention); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BlobAuditingPolicyState.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BlobAuditingPolicyState.java new file mode 100644 index 0000000000000..d5952d81fc6d4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/BlobAuditingPolicyState.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for BlobAuditingPolicyState. + */ +public enum BlobAuditingPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a BlobAuditingPolicyState instance. */ + private String value; + + BlobAuditingPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BlobAuditingPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed BlobAuditingPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static BlobAuditingPolicyState fromString(String value) { + BlobAuditingPolicyState[] items = BlobAuditingPolicyState.values(); + for (BlobAuditingPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CatalogCollationType.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CatalogCollationType.java new file mode 100644 index 0000000000000..c012452343025 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_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.v2017_03_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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CompleteDatabaseRestoreDefinition.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CompleteDatabaseRestoreDefinition.java new file mode 100644 index 0000000000000..f3474a97da8ac --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_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.v2017_03_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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateDatabaseRestorePointDefinition.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateDatabaseRestorePointDefinition.java new file mode 100644 index 0000000000000..705fed825267b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateDatabaseRestorePointDefinition.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a create database restore + * point operation. + */ +public class CreateDatabaseRestorePointDefinition { + /** + * The restore point label to apply. + */ + @JsonProperty(value = "restorePointLabel", required = true) + private String restorePointLabel; + + /** + * Get the restore point label to apply. + * + * @return the restorePointLabel value + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + + /** + * Set the restore point label to apply. + * + * @param restorePointLabel the restorePointLabel value to set + * @return the CreateDatabaseRestorePointDefinition object itself. + */ + public CreateDatabaseRestorePointDefinition withRestorePointLabel(String restorePointLabel) { + this.restorePointLabel = restorePointLabel; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateMode.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateMode.java new file mode 100644 index 0000000000000..e8f7d8cdfee80 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/CreateMode.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CreateMode. + */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value Copy for CreateMode. */ + public static final CreateMode COPY = fromString("Copy"); + + /** Static value Secondary for CreateMode. */ + public static final CreateMode SECONDARY = fromString("Secondary"); + + /** Static value OnlineSecondary for CreateMode. */ + public static final CreateMode ONLINE_SECONDARY = fromString("OnlineSecondary"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** Static value Recovery for CreateMode. */ + public static final CreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreExternalBackup for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value RestoreExternalBackupSecondary for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP_SECONDARY = fromString("RestoreExternalBackupSecondary"); + + /** Static value RestoreLongTermRetentionBackup for CreateMode. */ + public static final CreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** + * Creates or finds a CreateMode from its string representation. + * @param name a name to look for + * @return the corresponding CreateMode + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * @return known CreateMode values + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivities.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivities.java new file mode 100644 index 0000000000000..f6ef89898c927 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivities.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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DataWarehouseUserActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataWarehouseUserActivities. + */ +public interface DataWarehouseUserActivities extends HasInner { + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivity.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivity.java new file mode 100644 index 0000000000000..d9e9bb495ce20 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DataWarehouseUserActivity.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DataWarehouseUserActivityInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DataWarehouseUserActivity. + */ +public interface DataWarehouseUserActivity extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the activeQueriesCount value. + */ + Integer activeQueriesCount(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Database.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Database.java new file mode 100644 index 0000000000000..a027644ae02e1 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Database.java @@ -0,0 +1,538 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing Database. + */ +public interface Database extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the currentServiceObjectiveName value. + */ + String currentServiceObjectiveName(); + + /** + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * @return the elasticPoolId value. + */ + String elasticPoolId(); + + /** + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * @return the recoveryServicesRecoveryPointId value. + */ + String recoveryServicesRecoveryPointId(); + + /** + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the sourceDatabaseDeletionDate value. + */ + DateTime sourceDatabaseDeletionDate(); + + /** + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * @return the status value. + */ + DatabaseStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the Database definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Database definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Database definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the database definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the database definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the database definition allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the database definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database definition allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + WithCreate withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database definition allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database definition allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + WithCreate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database definition allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database definition allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + WithCreate withSampleName(SampleName sampleName); + } + + /** + * The stage of the database definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + WithCreate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the database definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithElasticPoolId, DefinitionStages.WithLongTermRetentionBackupResourceId, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRecoveryServicesRecoveryPointId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSku, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a Database update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithElasticPoolId, UpdateStages.WithLongTermRetentionBackupResourceId, UpdateStages.WithMaxSizeBytes, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRecoveryServicesRecoveryPointId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSku, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of Database update stages. + */ + interface UpdateStages { + /** + * The stage of the database update allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the database update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database update allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + Update withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database update allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + Update withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database update allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database update allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + Update withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database update allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database update allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + Update withSampleName(SampleName sampleName); + } + + /** + * The stage of the database update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + Update withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the database update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..e681e10a3fa0c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseBlobAuditingPolicies. + */ +public interface DatabaseBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..27b67793a2ac2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseBlobAuditingPolicy.java @@ -0,0 +1,282 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseBlobAuditingPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing DatabaseBlobAuditingPolicy. + */ +public interface DatabaseBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseBlobAuditingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a DatabaseBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of DatabaseBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databaseblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperation.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperation.java new file mode 100644 index 0000000000000..d51686187d1c4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperation.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseOperationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing DatabaseOperation. + */ +public interface DatabaseOperation extends HasInner, HasManager { + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @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 name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + ManagementOperationState state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperations.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperations.java new file mode 100644 index 0000000000000..997dededcee93 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseOperations.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.v2017_03_01_preview; + +import rx.Observable; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseOperations. + */ +public interface DatabaseOperations extends HasInner { + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId); + + /** + * Gets a list of operations performed on the 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. + * @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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseStatus.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseStatus.java new file mode 100644 index 0000000000000..54cc8db4aa327 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseStatus.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseStatus. + */ +public final class DatabaseStatus extends ExpandableStringEnum { + /** Static value Online for DatabaseStatus. */ + public static final DatabaseStatus ONLINE = fromString("Online"); + + /** Static value Restoring for DatabaseStatus. */ + public static final DatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value RecoveryPending for DatabaseStatus. */ + public static final DatabaseStatus RECOVERY_PENDING = fromString("RecoveryPending"); + + /** Static value Recovering for DatabaseStatus. */ + public static final DatabaseStatus RECOVERING = fromString("Recovering"); + + /** Static value Suspect for DatabaseStatus. */ + public static final DatabaseStatus SUSPECT = fromString("Suspect"); + + /** Static value Offline for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Standby for DatabaseStatus. */ + public static final DatabaseStatus STANDBY = fromString("Standby"); + + /** Static value Shutdown for DatabaseStatus. */ + public static final DatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value EmergencyMode for DatabaseStatus. */ + public static final DatabaseStatus EMERGENCY_MODE = fromString("EmergencyMode"); + + /** Static value AutoClosed for DatabaseStatus. */ + public static final DatabaseStatus AUTO_CLOSED = fromString("AutoClosed"); + + /** Static value Copying for DatabaseStatus. */ + public static final DatabaseStatus COPYING = fromString("Copying"); + + /** Static value Creating for DatabaseStatus. */ + public static final DatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for DatabaseStatus. */ + public static final DatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value OfflineSecondary for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_SECONDARY = fromString("OfflineSecondary"); + + /** Static value Pausing for DatabaseStatus. */ + public static final DatabaseStatus PAUSING = fromString("Pausing"); + + /** Static value Paused for DatabaseStatus. */ + public static final DatabaseStatus PAUSED = fromString("Paused"); + + /** Static value Resuming for DatabaseStatus. */ + public static final DatabaseStatus RESUMING = fromString("Resuming"); + + /** Static value Scaling for DatabaseStatus. */ + public static final DatabaseStatus SCALING = fromString("Scaling"); + + /** + * Creates or finds a DatabaseStatus from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseStatus + */ + @JsonCreator + public static DatabaseStatus fromString(String name) { + return fromString(name, DatabaseStatus.class); + } + + /** + * @return known DatabaseStatus values + */ + public static Collection values() { + return values(DatabaseStatus.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseUpdate.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseUpdate.java new file mode 100644 index 0000000000000..1c1e3ae68d00a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseUpdate.java @@ -0,0 +1,595 @@ +/** + * 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.v2017_03_01_preview; + +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseUpdate { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'OnlineSecondary', 'PointInTimeRestore', 'Restore', + * 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * 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; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'OnlineSecondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'OnlineSecondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessment.java new file mode 100644 index 0000000000000..c02a66458831f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessment.java @@ -0,0 +1,185 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseVulnerabilityAssessmentInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabaseVulnerabilityAssessment. + */ +public interface DatabaseVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessment definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a DatabaseVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerPath, UpdateStages.WithStorageContainerSasKey { + } + + /** + * Grouping of DatabaseVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + Update withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..078b40a5f80b9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseVulnerabilityAssessmentRuleBaselineInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; + +/** + * Type representing DatabaseVulnerabilityAssessmentRuleBaseline. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaseline extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the baselineResults value. + */ + List baselineResults(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRule, DefinitionStages.WithBaselineResults, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Blank extends WithRule { + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify Rule. + */ + interface WithRule { + /** + * Specifies resourceGroupName, serverName, databaseName, ruleId. + */ + WithBaselineResults withExistingRule(String resourceGroupName, String serverName, String databaseName, String ruleId); + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + WithCreate withBaselineResults(List baselineResults); + } + + /** + * 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 { + } + } + /** + * The template for a DatabaseVulnerabilityAssessmentRuleBaseline update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBaselineResults { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessmentrulebaseline update allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + Update withBaselineResults(List baselineResults); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 0000000000000..821465e50a45a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java @@ -0,0 +1,45 @@ +/** + * 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.v2017_03_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for an Azure SQL Database Vulnerability Assessment rule + * baseline's result. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /** + * The rule baseline result. + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** + * Get the rule baseline result. + * + * @return the result value + */ + public List result() { + return this.result; + } + + /** + * Set the rule baseline result. + * + * @param result the result value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineItem object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem withResult(List result) { + this.result = result; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselines.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..1ccda488f24ba --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,51 @@ +/** + * 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.v2017_03_01_preview; + +import rx.Observable; +import rx.Completable; + +/** + * Type representing DatabaseVulnerabilityAssessmentRuleBaselines. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaselines { + /** + * Begins definition for a new Baseline resource. + * @param name resource name. + * @return the first stage of the new Baseline definition. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank defineBaseline(String name); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessments.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..0719127f65895 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabaseVulnerabilityAssessments.java @@ -0,0 +1,54 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabaseVulnerabilityAssessmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseVulnerabilityAssessments. + */ +public interface DatabaseVulnerabilityAssessments extends SupportsCreating, HasInner { + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are 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); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Databases.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Databases.java new file mode 100644 index 0000000000000..0fffad64c64e0 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Databases.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.DatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Databases. + */ +public interface Databases extends SupportsCreating, HasInner { + /** + * Exports 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. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters); + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable pauseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName); + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable resumeAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id); + + /** + * Gets 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. + * @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 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 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 the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecution.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecution.java new file mode 100644 index 0000000000000..d6b5d27d500df --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecution.java @@ -0,0 +1,104 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobExecutionInner; +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.v2017_03_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ExecutionJobJobAgentServerJobExecution. + */ +public interface ExecutionJobJobAgentServerJobExecution extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the createTime value. + */ + DateTime createTime(); + + /** + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * @return the currentAttemptStartTime value. + */ + DateTime currentAttemptStartTime(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the stepName value. + */ + String stepName(); + + /** + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecutionModel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecutionModel.java new file mode 100644 index 0000000000000..56c6064e196de --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExecutionJobJobAgentServerJobExecutionModel.java @@ -0,0 +1,102 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobExecutionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ExecutionJobJobAgentServerJobExecutionModel. + */ +public interface ExecutionJobJobAgentServerJobExecutionModel extends HasInner, HasManager { + /** + * @return the createTime value. + */ + DateTime createTime(); + + /** + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * @return the currentAttemptStartTime value. + */ + DateTime currentAttemptStartTime(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the stepName value. + */ + String stepName(); + + /** + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..8650d52d676ff --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ExtendedDatabaseBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ExtendedDatabaseBlobAuditingPolicies. + */ +public interface ExtendedDatabaseBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets an extended database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..032ea639cd61c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedDatabaseBlobAuditingPolicy.java @@ -0,0 +1,302 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ExtendedDatabaseBlobAuditingPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ExtendedDatabaseBlobAuditingPolicy. + */ +public interface ExtendedDatabaseBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ExtendedDatabaseBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ExtendedDatabaseBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ExtendedDatabaseBlobAuditingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithPredicateExpression, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ExtendedDatabaseBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithPredicateExpression, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ExtendedDatabaseBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + Update withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..878d64fac3058 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicies.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ExtendedServerBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ExtendedServerBlobAuditingPolicies. + */ +public interface ExtendedServerBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets an extended server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..e4f92bcce91e8 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ExtendedServerBlobAuditingPolicy.java @@ -0,0 +1,302 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ExtendedServerBlobAuditingPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ExtendedServerBlobAuditingPolicy. + */ +public interface ExtendedServerBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ExtendedServerBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ExtendedServerBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ExtendedServerBlobAuditingPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithState withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithPredicateExpression, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ExtendedServerBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithPredicateExpression, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ExtendedServerBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + Update withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportDatabaseDefinition.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportDatabaseDefinition.java new file mode 100644 index 0000000000000..364c56b27c044 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportDatabaseDefinition.java @@ -0,0 +1,277 @@ +/** + * 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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform import/export operation. + */ +public class ImportExportDatabaseDefinition { + /** + * Name of the import database. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /** + * Edition of the import database. + */ + @JsonProperty(value = "edition") + private String edition; + + /** + * Service level objective name of the import database. + */ + @JsonProperty(value = "serviceObjectiveName") + private String serviceObjectiveName; + + /** + * Max size in bytes for the import database. + */ + @JsonProperty(value = "maxSizeBytes") + private String maxSizeBytes; + + /** + * Storage key type. + */ + @JsonProperty(value = "storageKeyType", required = true) + private String storageKeyType; + + /** + * Storage key. + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /** + * Storage Uri. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /** + * Administrator login name. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /** + * Administrator login password. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * Authentication type. + */ + @JsonProperty(value = "authenticationType") + private String authenticationType; + + /** + * Get name of the import database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set name of the import database. + * + * @param databaseName the databaseName value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get edition of the import database. + * + * @return the edition value + */ + public String edition() { + return this.edition; + } + + /** + * Set edition of the import database. + * + * @param edition the edition value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get service level objective name of the import database. + * + * @return the serviceObjectiveName value + */ + public String serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Set service level objective name of the import database. + * + * @param serviceObjectiveName the serviceObjectiveName value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withServiceObjectiveName(String serviceObjectiveName) { + this.serviceObjectiveName = serviceObjectiveName; + return this; + } + + /** + * Get max size in bytes for the import database. + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set max size in bytes for the import database. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get storage key type. + * + * @return the storageKeyType value + */ + public String storageKeyType() { + return this.storageKeyType; + } + + /** + * Set storage key type. + * + * @param storageKeyType the storageKeyType value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withStorageKeyType(String storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get storage key. + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set storage key. + * + * @param storageKey the storageKey value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get storage Uri. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set storage Uri. + * + * @param storageUri the storageUri value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get administrator login name. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator login name. + * + * @param administratorLogin the administratorLogin value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get administrator login password. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set administrator login password. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get authentication type. + * + * @return the authenticationType value + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Set authentication type. + * + * @param authenticationType the authenticationType value to set + * @return the ImportExportDatabaseDefinition object itself. + */ + public ImportExportDatabaseDefinition withAuthenticationType(String authenticationType) { + this.authenticationType = authenticationType; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportOperationResult.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportOperationResult.java new file mode 100644 index 0000000000000..41ae74e3d0b58 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ImportExportOperationResult.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ImportExportOperationResultInner; +import java.util.UUID; + +/** + * Type representing ImportExportOperationResult. + */ +public interface ImportExportOperationResult extends HasInner, HasManager { + /** + * @return the blobUri value. + */ + String blobUri(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the queuedTime value. + */ + String queuedTime(); + + /** + * @return the requestId value. + */ + UUID requestId(); + + /** + * @return the requestType value. + */ + String requestType(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Job.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Job.java new file mode 100644 index 0000000000000..9b5862ba7af7a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Job.java @@ -0,0 +1,140 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing Job. + */ +public interface Job extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the schedule value. + */ + JobSchedule schedule(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the version value. + */ + Integer version(); + + /** + * The entirety of the Job definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithCreate { + } + + /** + * Grouping of Job definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Job definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the job definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + + /** + * The stage of the job definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the job definition allowing to specify Schedule. + */ + interface WithSchedule { + /** + * Specifies schedule. + */ + WithCreate withSchedule(JobSchedule schedule); + } + + /** + * 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.WithDescription, DefinitionStages.WithSchedule { + } + } + /** + * The template for a Job update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithSchedule { + } + + /** + * Grouping of Job update stages. + */ + interface UpdateStages { + /** + * The stage of the job update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + */ + Update withDescription(String description); + } + + /** + * The stage of the job update allowing to specify Schedule. + */ + interface WithSchedule { + /** + * Specifies schedule. + */ + Update withSchedule(JobSchedule schedule); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgent.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgent.java new file mode 100644 index 0000000000000..b2de61cfd8642 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgent.java @@ -0,0 +1,171 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobAgentInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.Map; + +/** + * Type representing JobAgent. + */ +public interface JobAgent extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the databaseId value. + */ + String databaseId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the state value. + */ + JobAgentState state(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobAgent definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithDatabaseId, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobAgent definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobAgent definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the jobagent definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithDatabaseId withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the jobagent definition allowing to specify DatabaseId. + */ + interface WithDatabaseId { + /** + * Specifies databaseId. + */ + WithLocation withDatabaseId(String databaseId); + } + + /** + * The stage of the jobagent definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the jobagent definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the jobagent definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + 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.WithSku, DefinitionStages.WithTags { + } + } + /** + * The template for a JobAgent update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithSku, UpdateStages.WithTags { + } + + /** + * Grouping of JobAgent update stages. + */ + interface UpdateStages { + /** + * The stage of the jobagent update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the jobagent update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentServerJobExecution.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentServerJobExecution.java new file mode 100644 index 0000000000000..77a05e9f14b29 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentServerJobExecution.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobExecutionInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; + +/** + * Type representing JobAgentServerJobExecution. + */ +public interface JobAgentServerJobExecution extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the createTime value. + */ + DateTime createTime(); + + /** + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * @return the currentAttemptStartTime value. + */ + DateTime currentAttemptStartTime(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the stepName value. + */ + String stepName(); + + /** + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobAgentServerJobExecution definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobAgentServerJobExecution definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobAgentServerJobExecution definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the jobagentserverjobexecution definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName, jobName. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName, String jobName); + } + + /** + * 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 { + } + } + /** + * The template for a JobAgentServerJobExecution update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of JobAgentServerJobExecution update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentState.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentState.java new file mode 100644 index 0000000000000..cfa2929634655 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentState.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobAgentState. + */ +public final class JobAgentState extends ExpandableStringEnum { + /** Static value Creating for JobAgentState. */ + public static final JobAgentState CREATING = fromString("Creating"); + + /** Static value Ready for JobAgentState. */ + public static final JobAgentState READY = fromString("Ready"); + + /** Static value Updating for JobAgentState. */ + public static final JobAgentState UPDATING = fromString("Updating"); + + /** Static value Deleting for JobAgentState. */ + public static final JobAgentState DELETING = fromString("Deleting"); + + /** Static value Disabled for JobAgentState. */ + public static final JobAgentState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a JobAgentState from its string representation. + * @param name a name to look for + * @return the corresponding JobAgentState + */ + @JsonCreator + public static JobAgentState fromString(String name) { + return fromString(name, JobAgentState.class); + } + + /** + * @return known JobAgentState values + */ + public static Collection values() { + return values(JobAgentState.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentUpdate.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentUpdate.java new file mode 100644 index 0000000000000..05ffd450e120d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgentUpdate.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.v2017_03_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An update to an Azure SQL job agent. + */ +public class JobAgentUpdate { + /** + * 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 JobAgentUpdate object itself. + */ + public JobAgentUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgents.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgents.java new file mode 100644 index 0000000000000..6ecfac8e00f1d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobAgents.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobAgentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobAgents. + */ +public interface JobAgents extends SupportsCreating, HasInner { + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a list of job agents in 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredential.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredential.java new file mode 100644 index 0000000000000..66a50d09bd852 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredential.java @@ -0,0 +1,115 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobCredentialInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing JobCredential. + */ +public interface JobCredential extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the password value. + */ + String password(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the username value. + */ + String username(); + + /** + * The entirety of the JobCredential definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithPassword, DefinitionStages.WithUsername, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobCredential definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobCredential definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the jobcredential definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + */ + WithPassword withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + + /** + * The stage of the jobcredential definition allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + */ + WithUsername withPassword(String password); + } + + /** + * The stage of the jobcredential definition allowing to specify Username. + */ + interface WithUsername { + /** + * Specifies username. + */ + WithCreate withUsername(String username); + } + + /** + * 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 { + } + } + /** + * The template for a JobCredential update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of JobCredential update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredentials.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredentials.java new file mode 100644 index 0000000000000..1ef3ff8b184f5 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobCredentials.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobCredentialsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobCredentials. + */ +public interface JobCredentials extends SupportsCreating, HasInner { + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionLifecycle.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionLifecycle.java new file mode 100644 index 0000000000000..5f7cdb87603f6 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionLifecycle.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobExecutionLifecycle. + */ +public final class JobExecutionLifecycle extends ExpandableStringEnum { + /** Static value Created for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CREATED = fromString("Created"); + + /** Static value InProgress for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle IN_PROGRESS = fromString("InProgress"); + + /** Static value WaitingForChildJobExecutions for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_CHILD_JOB_EXECUTIONS = fromString("WaitingForChildJobExecutions"); + + /** Static value WaitingForRetry for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_RETRY = fromString("WaitingForRetry"); + + /** Static value Succeeded for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED = fromString("Succeeded"); + + /** Static value SucceededWithSkipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED_WITH_SKIPPED = fromString("SucceededWithSkipped"); + + /** Static value Failed for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle FAILED = fromString("Failed"); + + /** Static value TimedOut for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle TIMED_OUT = fromString("TimedOut"); + + /** Static value Canceled for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CANCELED = fromString("Canceled"); + + /** Static value Skipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SKIPPED = fromString("Skipped"); + + /** + * Creates or finds a JobExecutionLifecycle from its string representation. + * @param name a name to look for + * @return the corresponding JobExecutionLifecycle + */ + @JsonCreator + public static JobExecutionLifecycle fromString(String name) { + return fromString(name, JobExecutionLifecycle.class); + } + + /** + * @return known JobExecutionLifecycle values + */ + public static Collection values() { + return values(JobExecutionLifecycle.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionTarget.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionTarget.java new file mode 100644 index 0000000000000..48ae4c7b81eb7 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutionTarget.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The target that a job execution is executed on. + */ +public class JobExecutionTarget { + /** + * The type of the target. Possible values include: 'TargetGroup', + * 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private JobTargetType type; + + /** + * The server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * Get the type of the target. Possible values include: 'TargetGroup', 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + * + * @return the type value + */ + public JobTargetType type() { + return this.type; + } + + /** + * Get the server name. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutions.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutions.java new file mode 100644 index 0000000000000..00051d67cb0d8 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobExecutions.java @@ -0,0 +1,88 @@ +/** + * 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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgentServerJobExecution; +import rx.Completable; +import java.util.UUID; + +/** + * Type representing JobExecutions. + */ +public interface JobExecutions { + /** + * Begins definition for a new Execution resource. + * @param name resource name. + * @return the first stage of the new Execution definition. + */ + JobAgentServerJobExecution.DefinitionStages.Blank defineExecution(String name); + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName); + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSchedule.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSchedule.java new file mode 100644 index 0000000000000..788a7ecb607dc --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSchedule.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_03_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Scheduling properties of a job. + */ +public class JobSchedule { + /** + * Schedule start time. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * Schedule end time. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * Schedule interval type. Possible values include: 'Once', 'Recurring'. + */ + @JsonProperty(value = "type") + private JobScheduleType type; + + /** + * Whether or not the schedule is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Value of the schedule's recurring interval, if the scheduletype is + * recurring. ISO8601 duration format. + */ + @JsonProperty(value = "interval") + private String interval; + + /** + * Get schedule start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set schedule start time. + * + * @param startTime the startTime value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get schedule end time. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set schedule end time. + * + * @param endTime the endTime value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get schedule interval type. Possible values include: 'Once', 'Recurring'. + * + * @return the type value + */ + public JobScheduleType type() { + return this.type; + } + + /** + * Set schedule interval type. Possible values include: 'Once', 'Recurring'. + * + * @param type the type value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withType(JobScheduleType type) { + this.type = type; + return this; + } + + /** + * Get whether or not the schedule is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set whether or not the schedule is enabled. + * + * @param enabled the enabled value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get value of the schedule's recurring interval, if the scheduletype is recurring. ISO8601 duration format. + * + * @return the interval value + */ + public String interval() { + return this.interval; + } + + /** + * Set value of the schedule's recurring interval, if the scheduletype is recurring. ISO8601 duration format. + * + * @param interval the interval value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withInterval(String interval) { + this.interval = interval; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobScheduleType.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobScheduleType.java new file mode 100644 index 0000000000000..0bc475b3efee2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobScheduleType.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobScheduleType. + */ +public enum JobScheduleType { + /** Enum value Once. */ + ONCE("Once"), + + /** Enum value Recurring. */ + RECURRING("Recurring"); + + /** The actual serialized value for a JobScheduleType instance. */ + private String value; + + JobScheduleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobScheduleType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobScheduleType object, or null if unable to parse. + */ + @JsonCreator + public static JobScheduleType fromString(String value) { + JobScheduleType[] items = JobScheduleType.values(); + for (JobScheduleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStep.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStep.java new file mode 100644 index 0000000000000..cf2baf82ff846 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStep.java @@ -0,0 +1,204 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobStepInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing JobStep. + */ +public interface JobStep extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the action value. + */ + JobStepAction action(); + + /** + * @return the credential value. + */ + String credential(); + + /** + * @return the executionOptions value. + */ + JobStepExecutionOptions executionOptions(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the output value. + */ + JobStepOutput output(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the targetGroup value. + */ + String targetGroup(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobStep definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithVersion, DefinitionStages.WithAction, DefinitionStages.WithCredential, DefinitionStages.WithTargetGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobStep definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobStep definition. + */ + interface Blank extends WithVersion { + } + + /** + * The stage of the jobstep definition allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies resourceGroupName, serverName, jobAgentName, jobName. + */ + WithAction withExistingVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName); + } + + /** + * The stage of the jobstep definition allowing to specify Action. + */ + interface WithAction { + /** + * Specifies action. + */ + WithCredential withAction(JobStepAction action); + } + + /** + * The stage of the jobstep definition allowing to specify Credential. + */ + interface WithCredential { + /** + * Specifies credential. + */ + WithTargetGroup withCredential(String credential); + } + + /** + * The stage of the jobstep definition allowing to specify TargetGroup. + */ + interface WithTargetGroup { + /** + * Specifies targetGroup. + */ + WithCreate withTargetGroup(String targetGroup); + } + + /** + * The stage of the jobstep definition allowing to specify ExecutionOptions. + */ + interface WithExecutionOptions { + /** + * Specifies executionOptions. + */ + WithCreate withExecutionOptions(JobStepExecutionOptions executionOptions); + } + + /** + * The stage of the jobstep definition allowing to specify Output. + */ + interface WithOutput { + /** + * Specifies output. + */ + WithCreate withOutput(JobStepOutput output); + } + + /** + * The stage of the jobstep definition allowing to specify StepId. + */ + interface WithStepId { + /** + * Specifies stepId. + */ + WithCreate withStepId(Integer stepId); + } + + /** + * 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.WithExecutionOptions, DefinitionStages.WithOutput, DefinitionStages.WithStepId { + } + } + /** + * The template for a JobStep update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithExecutionOptions, UpdateStages.WithOutput, UpdateStages.WithStepId { + } + + /** + * Grouping of JobStep update stages. + */ + interface UpdateStages { + /** + * The stage of the jobstep update allowing to specify ExecutionOptions. + */ + interface WithExecutionOptions { + /** + * Specifies executionOptions. + */ + Update withExecutionOptions(JobStepExecutionOptions executionOptions); + } + + /** + * The stage of the jobstep update allowing to specify Output. + */ + interface WithOutput { + /** + * Specifies output. + */ + Update withOutput(JobStepOutput output); + } + + /** + * The stage of the jobstep update allowing to specify StepId. + */ + interface WithStepId { + /** + * Specifies stepId. + */ + Update withStepId(Integer stepId); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepAction.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepAction.java new file mode 100644 index 0000000000000..b0ce8556858fd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepAction.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The action to be executed by a job step. + */ +public class JobStepAction { + /** + * Type of action being executed by the job step. Possible values include: + * 'TSql'. + */ + @JsonProperty(value = "type") + private JobStepActionType type; + + /** + * The source of the action to execute. Possible values include: 'Inline'. + */ + @JsonProperty(value = "source") + private JobStepActionSource source; + + /** + * The action value, for example the text of the T-SQL script to execute. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get type of action being executed by the job step. Possible values include: 'TSql'. + * + * @return the type value + */ + public JobStepActionType type() { + return this.type; + } + + /** + * Set type of action being executed by the job step. Possible values include: 'TSql'. + * + * @param type the type value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withType(JobStepActionType type) { + this.type = type; + return this; + } + + /** + * Get the source of the action to execute. Possible values include: 'Inline'. + * + * @return the source value + */ + public JobStepActionSource source() { + return this.source; + } + + /** + * Set the source of the action to execute. Possible values include: 'Inline'. + * + * @param source the source value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withSource(JobStepActionSource source) { + this.source = source; + return this; + } + + /** + * Get the action value, for example the text of the T-SQL script to execute. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the action value, for example the text of the T-SQL script to execute. + * + * @param value the value value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionSource.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionSource.java new file mode 100644 index 0000000000000..d61e2b61719b1 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionSource.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepActionSource. + */ +public final class JobStepActionSource extends ExpandableStringEnum { + /** Static value Inline for JobStepActionSource. */ + public static final JobStepActionSource INLINE = fromString("Inline"); + + /** + * Creates or finds a JobStepActionSource from its string representation. + * @param name a name to look for + * @return the corresponding JobStepActionSource + */ + @JsonCreator + public static JobStepActionSource fromString(String name) { + return fromString(name, JobStepActionSource.class); + } + + /** + * @return known JobStepActionSource values + */ + public static Collection values() { + return values(JobStepActionSource.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionType.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionType.java new file mode 100644 index 0000000000000..09f515b223081 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepActionType.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepActionType. + */ +public final class JobStepActionType extends ExpandableStringEnum { + /** Static value TSql for JobStepActionType. */ + public static final JobStepActionType TSQL = fromString("TSql"); + + /** + * Creates or finds a JobStepActionType from its string representation. + * @param name a name to look for + * @return the corresponding JobStepActionType + */ + @JsonCreator + public static JobStepActionType fromString(String name) { + return fromString(name, JobStepActionType.class); + } + + /** + * @return known JobStepActionType values + */ + public static Collection values() { + return values(JobStepActionType.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutionOptions.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutionOptions.java new file mode 100644 index 0000000000000..9bbe25483407c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutionOptions.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The execution options of a job step. + */ +public class JobStepExecutionOptions { + /** + * Execution timeout for the job step. + */ + @JsonProperty(value = "timeoutSeconds") + private Integer timeoutSeconds; + + /** + * Maximum number of times the job step will be reattempted if the first + * attempt fails. + */ + @JsonProperty(value = "retryAttempts") + private Integer retryAttempts; + + /** + * Initial delay between retries for job step execution. + */ + @JsonProperty(value = "initialRetryIntervalSeconds") + private Integer initialRetryIntervalSeconds; + + /** + * The maximum amount of time to wait between retries for job step + * execution. + */ + @JsonProperty(value = "maximumRetryIntervalSeconds") + private Integer maximumRetryIntervalSeconds; + + /** + * The backoff multiplier for the time between retries. + */ + @JsonProperty(value = "retryIntervalBackoffMultiplier") + private Double retryIntervalBackoffMultiplier; + + /** + * Get execution timeout for the job step. + * + * @return the timeoutSeconds value + */ + public Integer timeoutSeconds() { + return this.timeoutSeconds; + } + + /** + * Set execution timeout for the job step. + * + * @param timeoutSeconds the timeoutSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withTimeoutSeconds(Integer timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + /** + * Get maximum number of times the job step will be reattempted if the first attempt fails. + * + * @return the retryAttempts value + */ + public Integer retryAttempts() { + return this.retryAttempts; + } + + /** + * Set maximum number of times the job step will be reattempted if the first attempt fails. + * + * @param retryAttempts the retryAttempts value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryAttempts(Integer retryAttempts) { + this.retryAttempts = retryAttempts; + return this; + } + + /** + * Get initial delay between retries for job step execution. + * + * @return the initialRetryIntervalSeconds value + */ + public Integer initialRetryIntervalSeconds() { + return this.initialRetryIntervalSeconds; + } + + /** + * Set initial delay between retries for job step execution. + * + * @param initialRetryIntervalSeconds the initialRetryIntervalSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withInitialRetryIntervalSeconds(Integer initialRetryIntervalSeconds) { + this.initialRetryIntervalSeconds = initialRetryIntervalSeconds; + return this; + } + + /** + * Get the maximum amount of time to wait between retries for job step execution. + * + * @return the maximumRetryIntervalSeconds value + */ + public Integer maximumRetryIntervalSeconds() { + return this.maximumRetryIntervalSeconds; + } + + /** + * Set the maximum amount of time to wait between retries for job step execution. + * + * @param maximumRetryIntervalSeconds the maximumRetryIntervalSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withMaximumRetryIntervalSeconds(Integer maximumRetryIntervalSeconds) { + this.maximumRetryIntervalSeconds = maximumRetryIntervalSeconds; + return this; + } + + /** + * Get the backoff multiplier for the time between retries. + * + * @return the retryIntervalBackoffMultiplier value + */ + public Double retryIntervalBackoffMultiplier() { + return this.retryIntervalBackoffMultiplier; + } + + /** + * Set the backoff multiplier for the time between retries. + * + * @param retryIntervalBackoffMultiplier the retryIntervalBackoffMultiplier value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryIntervalBackoffMultiplier(Double retryIntervalBackoffMultiplier) { + this.retryIntervalBackoffMultiplier = retryIntervalBackoffMultiplier; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java new file mode 100644 index 0000000000000..d096a4ddb832f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java @@ -0,0 +1,45 @@ +/** + * 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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecution; + +/** + * Type representing JobStepExecutions. + */ +public interface JobStepExecutions { + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName); + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutput.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutput.java new file mode 100644 index 0000000000000..5518dab1f7b2b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutput.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.v2017_03_01_preview; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The output configuration of a job step. + */ +public class JobStepOutput { + /** + * The output destination type. Possible values include: 'SqlDatabase'. + */ + @JsonProperty(value = "type") + private JobStepOutputType type; + + /** + * The output destination subscription id. + */ + @JsonProperty(value = "subscriptionId") + private UUID subscriptionId; + + /** + * The output destination resource group. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * The output destination server name. + */ + @JsonProperty(value = "serverName", required = true) + private String serverName; + + /** + * The output destination database. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * The output destination schema. + */ + @JsonProperty(value = "schemaName") + private String schemaName; + + /** + * The output destination table. + */ + @JsonProperty(value = "tableName", required = true) + private String tableName; + + /** + * The resource ID of the credential to use to connect to the output + * destination. + */ + @JsonProperty(value = "credential", required = true) + private String credential; + + /** + * Get the output destination type. Possible values include: 'SqlDatabase'. + * + * @return the type value + */ + public JobStepOutputType type() { + return this.type; + } + + /** + * Set the output destination type. Possible values include: 'SqlDatabase'. + * + * @param type the type value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withType(JobStepOutputType type) { + this.type = type; + return this; + } + + /** + * Get the output destination subscription id. + * + * @return the subscriptionId value + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the output destination subscription id. + * + * @param subscriptionId the subscriptionId value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSubscriptionId(UUID subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the output destination resource group. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the output destination resource group. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the output destination server name. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the output destination server name. + * + * @param serverName the serverName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the output destination database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the output destination database. + * + * @param databaseName the databaseName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the output destination schema. + * + * @return the schemaName value + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the output destination schema. + * + * @param schemaName the schemaName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the output destination table. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the output destination table. + * + * @param tableName the tableName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the resource ID of the credential to use to connect to the output destination. + * + * @return the credential value + */ + public String credential() { + return this.credential; + } + + /** + * Set the resource ID of the credential to use to connect to the output destination. + * + * @param credential the credential value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withCredential(String credential) { + this.credential = credential; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutputType.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutputType.java new file mode 100644 index 0000000000000..1ea526d221d18 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepOutputType.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepOutputType. + */ +public final class JobStepOutputType extends ExpandableStringEnum { + /** Static value SqlDatabase for JobStepOutputType. */ + public static final JobStepOutputType SQL_DATABASE = fromString("SqlDatabase"); + + /** + * Creates or finds a JobStepOutputType from its string representation. + * @param name a name to look for + * @return the corresponding JobStepOutputType + */ + @JsonCreator + public static JobStepOutputType fromString(String name) { + return fromString(name, JobStepOutputType.class); + } + + /** + * @return known JobStepOutputType values + */ + public static Collection values() { + return values(JobStepOutputType.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSteps.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSteps.java new file mode 100644 index 0000000000000..149c0673ceb44 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSteps.java @@ -0,0 +1,86 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobStepsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobSteps. + */ +public interface JobSteps extends SupportsCreating, HasInner { + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName); + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName); + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTarget.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTarget.java new file mode 100644 index 0000000000000..57be12a65acfb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTarget.java @@ -0,0 +1,204 @@ +/** + * 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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A job target, for example a specific database or a container of databases + * that is evaluated during job execution. + */ +public class JobTarget { + /** + * Whether the target is included or excluded from the group. Possible + * values include: 'Include', 'Exclude'. + */ + @JsonProperty(value = "membershipType") + private JobTargetGroupMembershipType membershipType; + + /** + * The target type. Possible values include: 'TargetGroup', 'SqlDatabase', + * 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + */ + @JsonProperty(value = "type", required = true) + private JobTargetType type; + + /** + * The target server name. + */ + @JsonProperty(value = "serverName") + private String serverName; + + /** + * The target database name. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /** + * The target elastic pool name. + */ + @JsonProperty(value = "elasticPoolName") + private String elasticPoolName; + + /** + * The target shard map. + */ + @JsonProperty(value = "shardMapName") + private String shardMapName; + + /** + * The resource ID of the credential that is used during job execution to + * connect to the target and determine the list of databases inside the + * target. + */ + @JsonProperty(value = "refreshCredential") + private String refreshCredential; + + /** + * Get whether the target is included or excluded from the group. Possible values include: 'Include', 'Exclude'. + * + * @return the membershipType value + */ + public JobTargetGroupMembershipType membershipType() { + return this.membershipType; + } + + /** + * Set whether the target is included or excluded from the group. Possible values include: 'Include', 'Exclude'. + * + * @param membershipType the membershipType value to set + * @return the JobTarget object itself. + */ + public JobTarget withMembershipType(JobTargetGroupMembershipType membershipType) { + this.membershipType = membershipType; + return this; + } + + /** + * Get the target type. Possible values include: 'TargetGroup', 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + * + * @return the type value + */ + public JobTargetType type() { + return this.type; + } + + /** + * Set the target type. Possible values include: 'TargetGroup', 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + * + * @param type the type value to set + * @return the JobTarget object itself. + */ + public JobTarget withType(JobTargetType type) { + this.type = type; + return this; + } + + /** + * Get the target server name. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the target server name. + * + * @param serverName the serverName value to set + * @return the JobTarget object itself. + */ + public JobTarget withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the target database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the target database name. + * + * @param databaseName the databaseName value to set + * @return the JobTarget object itself. + */ + public JobTarget withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the target elastic pool name. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the target elastic pool name. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the JobTarget object itself. + */ + public JobTarget withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the target shard map. + * + * @return the shardMapName value + */ + public String shardMapName() { + return this.shardMapName; + } + + /** + * Set the target shard map. + * + * @param shardMapName the shardMapName value to set + * @return the JobTarget object itself. + */ + public JobTarget withShardMapName(String shardMapName) { + this.shardMapName = shardMapName; + return this; + } + + /** + * Get the resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. + * + * @return the refreshCredential value + */ + public String refreshCredential() { + return this.refreshCredential; + } + + /** + * Set the resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. + * + * @param refreshCredential the refreshCredential value to set + * @return the JobTarget object itself. + */ + public JobTarget withRefreshCredential(String refreshCredential) { + this.refreshCredential = refreshCredential; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetExecutions.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetExecutions.java new file mode 100644 index 0000000000000..4d8b6ffd5e4c8 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetExecutions.java @@ -0,0 +1,61 @@ +/** + * 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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecutionModel; +import java.util.UUID; + +/** + * Type representing JobTargetExecutions. + */ +public interface JobTargetExecutions { + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId); + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName); + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroup.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroup.java new file mode 100644 index 0000000000000..70dffa1d681bf --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroup.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobTargetGroupInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; + +/** + * Type representing JobTargetGroup. + */ +public interface JobTargetGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the members value. + */ + List members(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobTargetGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithMembers, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobTargetGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobTargetGroup definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the jobtargetgroup definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + */ + WithMembers withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + + /** + * The stage of the jobtargetgroup definition allowing to specify Members. + */ + interface WithMembers { + /** + * Specifies members. + */ + WithCreate withMembers(List members); + } + + /** + * 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 { + } + } + /** + * The template for a JobTargetGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithMembers { + } + + /** + * Grouping of JobTargetGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the jobtargetgroup update allowing to specify Members. + */ + interface WithMembers { + /** + * Specifies members. + */ + Update withMembers(List members); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroupMembershipType.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroupMembershipType.java new file mode 100644 index 0000000000000..948a5bef954ce --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroupMembershipType.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobTargetGroupMembershipType. + */ +public enum JobTargetGroupMembershipType { + /** Enum value Include. */ + INCLUDE("Include"), + + /** Enum value Exclude. */ + EXCLUDE("Exclude"); + + /** The actual serialized value for a JobTargetGroupMembershipType instance. */ + private String value; + + JobTargetGroupMembershipType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobTargetGroupMembershipType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobTargetGroupMembershipType object, or null if unable to parse. + */ + @JsonCreator + public static JobTargetGroupMembershipType fromString(String value) { + JobTargetGroupMembershipType[] items = JobTargetGroupMembershipType.values(); + for (JobTargetGroupMembershipType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroups.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroups.java new file mode 100644 index 0000000000000..00d428fca4e60 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetGroups.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobTargetGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobTargetGroups. + */ +public interface JobTargetGroups extends SupportsCreating, HasInner { + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetType.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetType.java new file mode 100644 index 0000000000000..073d5e5e3c7bd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobTargetType.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobTargetType. + */ +public final class JobTargetType extends ExpandableStringEnum { + /** Static value TargetGroup for JobTargetType. */ + public static final JobTargetType TARGET_GROUP = fromString("TargetGroup"); + + /** Static value SqlDatabase for JobTargetType. */ + public static final JobTargetType SQL_DATABASE = fromString("SqlDatabase"); + + /** Static value SqlElasticPool for JobTargetType. */ + public static final JobTargetType SQL_ELASTIC_POOL = fromString("SqlElasticPool"); + + /** Static value SqlShardMap for JobTargetType. */ + public static final JobTargetType SQL_SHARD_MAP = fromString("SqlShardMap"); + + /** Static value SqlServer for JobTargetType. */ + public static final JobTargetType SQL_SERVER = fromString("SqlServer"); + + /** + * Creates or finds a JobTargetType from its string representation. + * @param name a name to look for + * @return the corresponding JobTargetType + */ + @JsonCreator + public static JobTargetType fromString(String name) { + return fromString(name, JobTargetType.class); + } + + /** + * @return known JobTargetType values + */ + public static Collection values() { + return values(JobTargetType.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersion.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersion.java new file mode 100644 index 0000000000000..e890eadd2ea2e --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersion.java @@ -0,0 +1,37 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobVersionInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing JobVersion. + */ +public interface JobVersion extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersions.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersions.java new file mode 100644 index 0000000000000..c3985a1ac6bda --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobVersions.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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobVersionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobVersions. + */ +public interface JobVersions extends HasInner { + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Jobs.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Jobs.java new file mode 100644 index 0000000000000..becd9e888794c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Jobs.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.JobsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Jobs. + */ +public interface Jobs extends SupportsCreating, HasInner { + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackup.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackup.java new file mode 100644 index 0000000000000..04f3c79ba797b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackup.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.LongTermRetentionBackupInner; +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.v2017_03_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing LongTermRetentionBackup. + */ +public interface LongTermRetentionBackup 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 name value. + */ + String name(); + + /** + * @return the serverCreateTime value. + */ + DateTime serverCreateTime(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java new file mode 100644 index 0000000000000..8a63b778727a8 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java @@ -0,0 +1,74 @@ +/** + * 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.v2017_03_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.LongTermRetentionBackupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LongTermRetentionBackups. + */ +public interface LongTermRetentionBackups extends HasInner { + /** + * Lists the long term retention backups for 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); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String locationName, final String longTermRetentionServerName); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionDatabaseState.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionDatabaseState.java new file mode 100644 index 0000000000000..a8a7d788a59a9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionDatabaseState.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LongTermRetentionDatabaseState. + */ +public final class LongTermRetentionDatabaseState extends ExpandableStringEnum { + /** Static value All for LongTermRetentionDatabaseState. */ + public static final LongTermRetentionDatabaseState ALL = fromString("All"); + + /** Static value Live for LongTermRetentionDatabaseState. */ + public static final LongTermRetentionDatabaseState LIVE = fromString("Live"); + + /** Static value Deleted for LongTermRetentionDatabaseState. */ + public static final LongTermRetentionDatabaseState DELETED = fromString("Deleted"); + + /** + * Creates or finds a LongTermRetentionDatabaseState from its string representation. + * @param name a name to look for + * @return the corresponding LongTermRetentionDatabaseState + */ + @JsonCreator + public static LongTermRetentionDatabaseState fromString(String name) { + return fromString(name, LongTermRetentionDatabaseState.class); + } + + /** + * @return known LongTermRetentionDatabaseState values + */ + public static Collection values() { + return values(LongTermRetentionDatabaseState.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..03caf7827e711 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedBackupShortTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedBackupShortTermRetentionPolicies. + */ +public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a managed database's short 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..30379a6aa79f4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedBackupShortTermRetentionPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing ManagedBackupShortTermRetentionPolicy. + */ +public interface ManagedBackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedBackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedBackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedBackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the managedbackupshorttermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * 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 { + } + } + /** + * The template for a ManagedBackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java new file mode 100644 index 0000000000000..16b255adeb709 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java @@ -0,0 +1,327 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_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.v2017_03_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 name value. + */ + String name(); + + /** + * @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. + */ + WithLocation withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the manageddatabase definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the manageddatabase definition allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the manageddatabase definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the manageddatabase definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(ManagedDatabaseCreateMode createMode); + } + + /** + * The stage of the manageddatabase definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the manageddatabase definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the manageddatabase definition allowing to specify StorageContainerSasToken. + */ + interface WithStorageContainerSasToken { + /** + * Specifies storageContainerSasToken. + */ + WithCreate withStorageContainerSasToken(String storageContainerSasToken); + } + + /** + * The stage of the manageddatabase definition allowing to specify StorageContainerUri. + */ + interface WithStorageContainerUri { + /** + * Specifies storageContainerUri. + */ + WithCreate withStorageContainerUri(String storageContainerUri); + } + + /** + * The stage of the manageddatabase definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + 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.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.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. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the manageddatabase update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the manageddatabase update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(ManagedDatabaseCreateMode createMode); + } + + /** + * The stage of the manageddatabase update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the manageddatabase update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the manageddatabase update allowing to specify StorageContainerSasToken. + */ + interface WithStorageContainerSasToken { + /** + * Specifies storageContainerSasToken. + */ + Update withStorageContainerSasToken(String storageContainerSasToken); + } + + /** + * The stage of the manageddatabase update allowing to specify StorageContainerUri. + */ + interface WithStorageContainerUri { + /** + * Specifies storageContainerUri. + */ + Update withStorageContainerUri(String storageContainerUri); + } + + /** + * The stage of the manageddatabase update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java new file mode 100644 index 0000000000000..401fce50ffa2b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.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.v2017_03_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"); + + /** + * 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.java new file mode 100644 index 0000000000000..6c1711fbaa134 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.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.v2017_03_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"); + + /** + * 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseUpdate.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseUpdate.java new file mode 100644 index 0000000000000..5e97692aaf11d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseUpdate.java @@ -0,0 +1,319 @@ +/** + * 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.v2017_03_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 for the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible'. + */ + @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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + */ + @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; + + /** + * 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; + + /** + * 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 for the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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 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 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabases.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabases.java new file mode 100644 index 0000000000000..9547e9bcf1664 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabase; +import rx.Completable; +import java.util.UUID; + +/** + * 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 the 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 locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagementOperationState.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagementOperationState.java new file mode 100644 index 0000000000000..3f6b1bb5cc8d6 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_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.v2017_03_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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ProvisioningState.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ProvisioningState.java new file mode 100644 index 0000000000000..acd2e03464020 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ProvisioningState.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** Static value InProgress for ProvisioningState. */ + public static final ProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ResourceMoveDefinition.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ResourceMoveDefinition.java new file mode 100644 index 0000000000000..3ed9786dc0771 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ResourceMoveDefinition.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a resource move (rename). + */ +public class ResourceMoveDefinition { + /** + * The target ID for the resource. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the target ID for the resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the target ID for the resource. + * + * @param id the id value to set + * @return the ResourceMoveDefinition object itself. + */ + public ResourceMoveDefinition withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoint.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoint.java new file mode 100644 index 0000000000000..82bbd0c0ced62 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoint.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.RestorePointInner; +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.v2017_03_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RestorePoint. + */ +public interface RestorePoint extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the restorePointCreationDate value. + */ + DateTime restorePointCreationDate(); + + /** + * @return the restorePointLabel value. + */ + String restorePointLabel(); + + /** + * @return the restorePointType value. + */ + RestorePointType restorePointType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePointType.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePointType.java new file mode 100644 index 0000000000000..1be2357508e03 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePointType.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RestorePointType. + */ +public enum RestorePointType { + /** Enum value CONTINUOUS. */ + CONTINUOUS("CONTINUOUS"), + + /** Enum value DISCRETE. */ + DISCRETE("DISCRETE"); + + /** The actual serialized value for a RestorePointType instance. */ + private String value; + + RestorePointType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestorePointType instance. + * + * @param value the serialized value to parse. + * @return the parsed RestorePointType object, or null if unable to parse. + */ + @JsonCreator + public static RestorePointType fromString(String value) { + RestorePointType[] items = RestorePointType.values(); + for (RestorePointType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoints.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoints.java new file mode 100644 index 0000000000000..3fe1d4562d11a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorePoints.java @@ -0,0 +1,67 @@ +/** + * 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.v2017_03_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.RestorePointsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RestorePoints. + */ +public interface RestorePoints extends HasInner { + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SampleName.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SampleName.java new file mode 100644 index 0000000000000..78f06192296f6 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SampleName.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.v2017_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SampleName. + */ +public final class SampleName extends ExpandableStringEnum { + /** Static value AdventureWorksLT for SampleName. */ + public static final SampleName ADVENTURE_WORKS_LT = fromString("AdventureWorksLT"); + + /** Static value WideWorldImportersStd for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_STD = fromString("WideWorldImportersStd"); + + /** Static value WideWorldImportersFull for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_FULL = fromString("WideWorldImportersFull"); + + /** + * Creates or finds a SampleName from its string representation. + * @param name a name to look for + * @return the corresponding SampleName + */ + @JsonCreator + public static SampleName fromString(String name) { + return fromString(name, SampleName.class); + } + + /** + * @return known SampleName values + */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SecurityAlertPolicyState.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..61f66d0401b1c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_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.v2017_03_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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTuning.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTuning.java new file mode 100644 index 0000000000000..bb10f87a954ba --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTuning.java @@ -0,0 +1,51 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerAutomaticTuningInner; +import java.util.Map; + +/** + * Type representing ServerAutomaticTuning. + */ +public interface ServerAutomaticTuning extends HasInner, HasManager { + /** + * @return the actualState value. + */ + AutomaticTuningServerMode actualState(); + + /** + * @return the desiredState value. + */ + AutomaticTuningServerMode desiredState(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the options value. + */ + Map options(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTunings.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTunings.java new file mode 100644 index 0000000000000..e82593f15db54 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerAutomaticTunings.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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerAutomaticTuningInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerAutomaticTuningsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerAutomaticTunings. + */ +public interface ServerAutomaticTunings extends HasInner { + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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); + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..b00b9bb0558dc --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicies.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerBlobAuditingPolicies. + */ +public interface ServerBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets a server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..97dce114209a5 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerBlobAuditingPolicy.java @@ -0,0 +1,277 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerBlobAuditingPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ServerBlobAuditingPolicy. + */ +public interface ServerBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerBlobAuditingPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithState withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ServerBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ServerBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the serverblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAlias.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAlias.java new file mode 100644 index 0000000000000..3988e49d5f097 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAlias.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerDnsAliasInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing ServerDnsAlias. + */ +public interface ServerDnsAlias extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the azureDnsRecord value. + */ + String azureDnsRecord(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerDnsAlias definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerDnsAlias definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerDnsAlias definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverdnsalias definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + + /** + * 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 { + } + } + /** + * The template for a ServerDnsAlias update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ServerDnsAlias update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliasAcquisition.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliasAcquisition.java new file mode 100644 index 0000000000000..d43824aea5efe --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliasAcquisition.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A server DNS alias acquisition request. + */ +public class ServerDnsAliasAcquisition { + /** + * The id of the server alias that will be acquired to point to this server + * instead. + */ + @JsonProperty(value = "oldServerDnsAliasId") + private String oldServerDnsAliasId; + + /** + * Get the id of the server alias that will be acquired to point to this server instead. + * + * @return the oldServerDnsAliasId value + */ + public String oldServerDnsAliasId() { + return this.oldServerDnsAliasId; + } + + /** + * Set the id of the server alias that will be acquired to point to this server instead. + * + * @param oldServerDnsAliasId the oldServerDnsAliasId value to set + * @return the ServerDnsAliasAcquisition object itself. + */ + public ServerDnsAliasAcquisition withOldServerDnsAliasId(String oldServerDnsAliasId) { + this.oldServerDnsAliasId = oldServerDnsAliasId; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliases.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliases.java new file mode 100644 index 0000000000000..b99a0053c3f80 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerDnsAliases.java @@ -0,0 +1,64 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerDnsAliasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerDnsAliases. + */ +public interface ServerDnsAliases extends SupportsCreating, HasInner { + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Gets a list of server DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String dnsAliasName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..f27795c42361b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicies.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerSecurityAlertPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerSecurityAlertPolicies. + */ +public interface ServerSecurityAlertPolicies extends SupportsCreating, HasInner { + /** + * Get a server'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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..186e024a92108 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java @@ -0,0 +1,251 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ServerSecurityAlertPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; + +/** + * Type representing ServerSecurityAlertPolicy. + */ +public interface ServerSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @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 ServerSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerSecurityAlertPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithState withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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 ServerSecurityAlertPolicy 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 ServerSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the serversecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Sku.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Sku.java new file mode 100644 index 0000000000000..42ceb5d238ce6 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/Sku.java @@ -0,0 +1,152 @@ +/** + * 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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the 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 if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentPolicyBaselineName.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentPolicyBaselineName.java new file mode 100644 index 0000000000000..10b6b00b853de --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentPolicyBaselineName.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for VulnerabilityAssessmentPolicyBaselineName. + */ +public enum VulnerabilityAssessmentPolicyBaselineName { + /** Enum value master. */ + MASTER("master"), + + /** Enum value default. */ + DEFAULT("default"); + + /** The actual serialized value for a VulnerabilityAssessmentPolicyBaselineName instance. */ + private String value; + + VulnerabilityAssessmentPolicyBaselineName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a VulnerabilityAssessmentPolicyBaselineName instance. + * + * @param value the serialized value to parse. + * @return the parsed VulnerabilityAssessmentPolicyBaselineName object, or null if unable to parse. + */ + @JsonCreator + public static VulnerabilityAssessmentPolicyBaselineName fromString(String value) { + VulnerabilityAssessmentPolicyBaselineName[] items = VulnerabilityAssessmentPolicyBaselineName.values(); + for (VulnerabilityAssessmentPolicyBaselineName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentRecurringScansProperties.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..b6858f5c31faa --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,98 @@ +/** + * 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.v2017_03_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get recurring scans state. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set recurring scans state. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..1d56b1cac3fd9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesImpl.java @@ -0,0 +1,67 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.BackupLongTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.BackupLongTermRetentionPolicy; + +class BackupLongTermRetentionPoliciesImpl extends WrapperImpl implements BackupLongTermRetentionPolicies { + private final SqlManager manager; + + BackupLongTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().backupLongTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public BackupLongTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private BackupLongTermRetentionPolicyImpl wrapModel(BackupLongTermRetentionPolicyInner inner) { + return new BackupLongTermRetentionPolicyImpl(inner, manager()); + } + + private BackupLongTermRetentionPolicyImpl wrapModel(String name) { + return new BackupLongTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + BackupLongTermRetentionPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupLongTermRetentionPolicy call(BackupLongTermRetentionPolicyInner inner) { + return new BackupLongTermRetentionPolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + BackupLongTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupLongTermRetentionPolicy call(BackupLongTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..f5a1e9b09bdb1 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesInner.java @@ -0,0 +1,450 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BackupLongTermRetentionPolicies. + */ +public class BackupLongTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private BackupLongTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupLongTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackupLongTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(BackupLongTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BackupLongTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface BackupLongTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.BackupLongTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v2017_03_01_preview.BackupLongTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body BackupLongTermRetentionPolicyInner 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.v2017_03_01_preview.BackupLongTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body BackupLongTermRetentionPolicyInner 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.v2017_03_01_preview.BackupLongTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies") + 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); + + } + + /** + * 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).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 serverName The name of the server. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner 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 policyName = "default"; + return service.get(resourceGroupName, serverName, 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 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner 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 policyName = "default"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, 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 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Sets 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner 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 policyName = "default"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).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 serverName The name of the server. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable> listByDatabaseWithServiceResponseAsync(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."); + } + 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 clientResponse = listByDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByDatabaseDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..8f14735eaf430 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.BackupLongTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class BackupLongTermRetentionPolicyImpl extends CreatableUpdatableImpl implements BackupLongTermRetentionPolicy, BackupLongTermRetentionPolicy.Definition, BackupLongTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + BackupLongTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new BackupLongTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + BackupLongTermRetentionPolicyImpl(BackupLongTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, 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 BackupLongTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withMonthlyRetention(String monthlyRetention) { + this.inner().withMonthlyRetention(monthlyRetention); + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withWeeklyRetention(String weeklyRetention) { + this.inner().withWeeklyRetention(weeklyRetention); + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withWeekOfYear(Integer weekOfYear) { + this.inner().withWeekOfYear(weekOfYear); + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withYearlyRetention(String yearlyRetention) { + this.inner().withYearlyRetention(yearlyRetention); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..9aa077dd803ba --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPolicyInner.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.v2017_03_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 BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesImpl.java new file mode 100644 index 0000000000000..9cf8bf95a7166 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesImpl.java @@ -0,0 +1,46 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DataWarehouseUserActivities; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DataWarehouseUserActivity; + +class DataWarehouseUserActivitiesImpl extends WrapperImpl implements DataWarehouseUserActivities { + private final SqlManager manager; + + DataWarehouseUserActivitiesImpl(SqlManager manager) { + super(manager.inner().dataWarehouseUserActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DataWarehouseUserActivityImpl wrapModel(DataWarehouseUserActivityInner inner) { + return new DataWarehouseUserActivityImpl(inner, manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DataWarehouseUserActivitiesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DataWarehouseUserActivity call(DataWarehouseUserActivityInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.java new file mode 100644 index 0000000000000..18e5e1117c81a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.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.v2017_03_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 DataWarehouseUserActivities. + */ +public class DataWarehouseUserActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private DataWarehouseUserActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DataWarehouseUserActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataWarehouseUserActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DataWarehouseUserActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataWarehouseUserActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface DataWarehouseUserActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.DataWarehouseUserActivities get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataWarehouseUserActivityName") String dataWarehouseUserActivityName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The 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. + * @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 DataWarehouseUserActivityInner object if successful. + */ + public DataWarehouseUserActivityInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The 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. + * @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 the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataWarehouseUserActivityInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DataWarehouseUserActivityInner>() { + @Override + public DataWarehouseUserActivityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataWarehouseUserActivityInner 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 dataWarehouseUserActivityName = "current"; + return service.get(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityImpl.java new file mode 100644 index 0000000000000..9981e90224e6f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DataWarehouseUserActivity; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class DataWarehouseUserActivityImpl extends IndexableRefreshableWrapperImpl implements DataWarehouseUserActivity { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DataWarehouseUserActivityImpl(DataWarehouseUserActivityInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + 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 + protected Observable getInnerAsync() { + DataWarehouseUserActivitiesInner client = this.manager().inner().dataWarehouseUserActivities(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + + + @Override + public Integer activeQueriesCount() { + return this.inner().activeQueriesCount(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityInner.java new file mode 100644 index 0000000000000..5bd92ea8e5912 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivityInner.java @@ -0,0 +1,35 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * User activities of a data warehouse. + */ +@JsonFlatten +public class DataWarehouseUserActivityInner extends ProxyResource { + /** + * Count of running and suspended queries. + */ + @JsonProperty(value = "properties.activeQueriesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer activeQueriesCount; + + /** + * Get count of running and suspended queries. + * + * @return the activeQueriesCount value + */ + public Integer activeQueriesCount() { + return this.activeQueriesCount; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..5acd10ca3ff1a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseBlobAuditingPolicy; + +class DatabaseBlobAuditingPoliciesImpl extends WrapperImpl implements DatabaseBlobAuditingPolicies { + private final SqlManager manager; + + DatabaseBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private DatabaseBlobAuditingPolicyImpl wrapModel(DatabaseBlobAuditingPolicyInner inner) { + return new DatabaseBlobAuditingPolicyImpl(inner, manager()); + } + + private DatabaseBlobAuditingPolicyImpl wrapModel(String name) { + return new DatabaseBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseBlobAuditingPolicy call(DatabaseBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..192c05c8f0e49 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseBlobAuditingPolicies. + */ +public class DatabaseBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v2017_03_01_preview.DatabaseBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body DatabaseBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's blob auditing 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. + * @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 DatabaseBlobAuditingPolicyInner object if successful. + */ + public DatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's blob auditing 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. + * @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 blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseBlobAuditingPolicyInner>() { + @Override + public DatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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 blob auditing 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. + * @param parameters The database blob auditing 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 DatabaseBlobAuditingPolicyInner object if successful. + */ + public DatabaseBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing 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, DatabaseBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseBlobAuditingPolicyInner>() { + @Override + public DatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..55ab6f4e56057 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,191 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class DatabaseBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements DatabaseBlobAuditingPolicy, DatabaseBlobAuditingPolicy.Definition, DatabaseBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new DatabaseBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseBlobAuditingPolicyImpl(DatabaseBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseBlobAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..1ed33eee12beb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,443 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database blob auditing policy. + */ +@JsonFlatten +public class DatabaseBlobAuditingPolicyInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..65e0ba4bc5c8c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseImpl.java @@ -0,0 +1,410 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.Database; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseUpdate; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_03_01_preview.CreateMode; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SampleName; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseStatus; +import com.microsoft.azure.management.sql.v2017_03_01_preview.CatalogCollationType; +import rx.functions.Func1; + +class DatabaseImpl extends CreatableUpdatableImpl implements Database, Database.Definition, Database.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private DatabaseUpdate updateParameter; + + DatabaseImpl(String name, SqlManager manager) { + super(name, new DatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new DatabaseUpdate(); + } + + DatabaseImpl(DatabaseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public CatalogCollationType catalogCollation() { + return this.inner().catalogCollation(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public CreateMode createMode() { + return this.inner().createMode(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String currentServiceObjectiveName() { + return this.inner().currentServiceObjectiveName(); + } + + @Override + public UUID databaseId() { + return this.inner().databaseId(); + } + + @Override + public String defaultSecondaryLocation() { + return this.inner().defaultSecondaryLocation(); + } + + @Override + public String elasticPoolId() { + return this.inner().elasticPoolId(); + } + + @Override + public String failoverGroupId() { + return this.inner().failoverGroupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String longTermRetentionBackupResourceId() { + return this.inner().longTermRetentionBackupResourceId(); + } + + @Override + public Long maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recoverableDatabaseId() { + return this.inner().recoverableDatabaseId(); + } + + @Override + public String recoveryServicesRecoveryPointId() { + return this.inner().recoveryServicesRecoveryPointId(); + } + + @Override + public String restorableDroppedDatabaseId() { + return this.inner().restorableDroppedDatabaseId(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public SampleName sampleName() { + return this.inner().sampleName(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public DateTime sourceDatabaseDeletionDate() { + return this.inner().sourceDatabaseDeletionDate(); + } + + @Override + public String sourceDatabaseId() { + return this.inner().sourceDatabaseId(); + } + + @Override + public DatabaseStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public DatabaseImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + if (isInCreateMode()) { + this.inner().withCatalogCollation(catalogCollation); + } else { + this.updateParameter.withCatalogCollation(catalogCollation); + } + return this; + } + + @Override + public DatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public DatabaseImpl withCreateMode(CreateMode createMode) { + if (isInCreateMode()) { + this.inner().withCreateMode(createMode); + } else { + this.updateParameter.withCreateMode(createMode); + } + return this; + } + + @Override + public DatabaseImpl withElasticPoolId(String elasticPoolId) { + if (isInCreateMode()) { + this.inner().withElasticPoolId(elasticPoolId); + } else { + this.updateParameter.withElasticPoolId(elasticPoolId); + } + return this; + } + + @Override + public DatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (isInCreateMode()) { + this.inner().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } else { + this.updateParameter.withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } + return this; + } + + @Override + public DatabaseImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public DatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.inner().withRecoverableDatabaseId(recoverableDatabaseId); + } else { + this.updateParameter.withRecoverableDatabaseId(recoverableDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + if (isInCreateMode()) { + this.inner().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } else { + this.updateParameter.withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } + return this; + } + + @Override + public DatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.inner().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } else { + this.updateParameter.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public DatabaseImpl withSampleName(SampleName sampleName) { + if (isInCreateMode()) { + this.inner().withSampleName(sampleName); + } else { + this.updateParameter.withSampleName(sampleName); + } + return this; + } + + @Override + public DatabaseImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } else { + this.updateParameter.withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + } else { + this.updateParameter.withSourceDatabaseId(sourceDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseInner.java new file mode 100644 index 0000000000000..f0178caf85dc3 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseInner.java @@ -0,0 +1,589 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_03_01_preview.CreateMode; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SampleName; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseStatus; +import java.util.UUID; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_03_01_preview.CatalogCollationType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Kind of database. This is metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'OnlineSecondary', 'PointInTimeRestore', 'Restore', + * 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * 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; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'OnlineSecondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'OnlineSecondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + 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 DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationImpl.java new file mode 100644 index 0000000000000..0fec1996c7a1d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagementOperationState; + +class DatabaseOperationImpl extends WrapperImpl implements DatabaseOperation { + private final SqlManager manager; + + DatabaseOperationImpl(DatabaseOperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @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 name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationInner.java new file mode 100644 index 0000000000000..9ab8621ce77ec --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationInner.java @@ -0,0 +1,233 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database operation. + */ +@JsonFlatten +public class DatabaseOperationInner extends ProxyResource { + /** + * The name of the database the operation is being performed on. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * 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 name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * 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; + + /** + * Get the name of the database the operation is being performed on. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * 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 name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * 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; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsImpl.java new file mode 100644 index 0000000000000..2aca0eeaf34b3 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseOperation; + +class DatabaseOperationsImpl extends WrapperImpl implements DatabaseOperations { + private final SqlManager manager; + + DatabaseOperationsImpl(SqlManager manager) { + super(manager.inner().databaseOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabaseOperationImpl wrapModel(DatabaseOperationInner inner) { + return new DatabaseOperationImpl(inner, manager()); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + DatabaseOperationsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, databaseName, operationId).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseOperationsInner 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 DatabaseOperation call(DatabaseOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java new file mode 100644 index 0000000000000..c99cbb582ca77 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java @@ -0,0 +1,417 @@ +/** + * 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.v2017_03_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.POST; +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 DatabaseOperations. + */ +public class DatabaseOperationsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseOperations cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v2017_03_01_preview.DatabaseOperations listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations") + 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.v2017_03_01_preview.DatabaseOperations listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).toBlocking().single().body(); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @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 cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId), serviceCallback); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + 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 (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.cancel(resourceGroupName, serverName, databaseName, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 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. + * @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<DatabaseOperationInner> 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 operations performed on the 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. + * @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 operations performed on the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseOperationInner> 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 operations performed on the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseOperationInner> 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 operations performed on the 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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); + } + + /** + * Gets a list of operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..9155e02f401b5 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -0,0 +1,140 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.VulnerabilityAssessmentRecurringScansProperties; + +class DatabaseVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessment, DatabaseVulnerabilityAssessment.Definition, DatabaseVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseVulnerabilityAssessmentImpl(DatabaseVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DatabaseVulnerabilityAssessmentsInner client = this.manager().inner().databaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseVulnerabilityAssessmentsInner client = this.manager().inner().databaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentsInner client = this.manager().inner().databaseVulnerabilityAssessments(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @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 VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..4a37af17d5246 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java @@ -0,0 +1,132 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if + * server level vulnerability assessment policy doesn't set. + */ + @JsonProperty(value = "properties.storageContainerPath") + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..904292108d243 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,120 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v2017_03_01_preview.VulnerabilityAssessmentPolicyBaselineName; + +class DatabaseVulnerabilityAssessmentRuleBaselineImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessmentRuleBaseline, DatabaseVulnerabilityAssessmentRuleBaseline.Definition, DatabaseVulnerabilityAssessmentRuleBaseline.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String ruleId; + private VulnerabilityAssessmentPolicyBaselineName baselineName; + private List cbaselineResults; + private List ubaselineResults; + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentRuleBaselineInner()); + this.manager = manager; + // Set resource name + this.baselineName = name; + // + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(DatabaseVulnerabilityAssessmentRuleBaselineInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.baselineName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.ruleId = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + this.baselineName = IdParsingUtils.getValueFromIdByName(inner.id(), "baselines"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().databaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ruleId, this.baselineName, this.cbaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().databaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ruleId, this.baselineName, this.ubaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().databaseVulnerabilityAssessmentRuleBaselines(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ruleId, this.baselineName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List baselineResults() { + return this.inner().baselineResults(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withExistingRule(String resourceGroupName, String serverName, String databaseName, String ruleId) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.ruleId = ruleId; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withBaselineResults(List baselineResults) { + if (isInCreateMode()) { + this.cbaselineResults = baselineResults; + } else { + this.ubaselineResults = baselineResults; + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..5d566ebfc67a8 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java @@ -0,0 +1,48 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment rule baseline. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /** + * The rule baseline result. + */ + @JsonProperty(value = "properties.baselineResults", required = true) + private List baselineResults; + + /** + * Get the rule baseline result. + * + * @return the baselineResults value + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the rule baseline result. + * + * @param baselineResults the baselineResults value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults(List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..954b50c1f4dc6 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,72 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselines; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaseline; +import rx.Completable; + +class DatabaseVulnerabilityAssessmentRuleBaselinesImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentRuleBaselines { + private final SqlManager manager; + + DatabaseVulnerabilityAssessmentRuleBaselinesImpl(SqlManager manager) { + super(manager.inner().databaseVulnerabilityAssessmentRuleBaselines()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl defineBaseline(String name) { + return wrapBaselineModel(name); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapBaselineModel(String name) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentRuleBaselineInnerUsingDatabaseVulnerabilityAssessmentRuleBaselinesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String ruleId = IdParsingUtils.getValueFromIdByName(id, "rules"); + String baselineName = IdParsingUtils.getValueFromIdByName(id, "baselines"); + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaseline call(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java new file mode 100644 index 0000000000000..7c76847778cec --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java @@ -0,0 +1,408 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v2017_03_01_preview.VulnerabilityAssessmentPolicyBaselineName; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseVulnerabilityAssessmentRuleBaselines. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentRuleBaselinesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentRuleBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentRuleBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessmentRuleBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @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.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner get(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName, baselineResults).toBlocking().single().body(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName, baselineResults), serviceCallback); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName, baselineResults).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 (baselineResults == null) { + throw new IllegalArgumentException("Parameter baselineResults is required and cannot be null."); + } + Validator.validate(baselineResults); + final String vulnerabilityAssessmentName = "default"; + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + parameters.withBaselineResults(baselineResults); + return service.createOrUpdate(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 = 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..2e69ad6f606ab --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessments; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessment; + +class DatabaseVulnerabilityAssessmentsImpl extends WrapperImpl implements DatabaseVulnerabilityAssessments { + private final SqlManager manager; + + DatabaseVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().databaseVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl define(String name) { + return wrapModel(name); + } + + private DatabaseVulnerabilityAssessmentImpl wrapModel(DatabaseVulnerabilityAssessmentInner inner) { + return new DatabaseVulnerabilityAssessmentImpl(inner, manager()); + } + + private DatabaseVulnerabilityAssessmentImpl wrapModel(String name) { + return new DatabaseVulnerabilityAssessmentImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseVulnerabilityAssessmentsInner 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 DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..6fbcff0fab6bf --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsInner.java @@ -0,0 +1,618 @@ +/** + * 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.v2017_03_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 DatabaseVulnerabilityAssessments. + */ +public class DatabaseVulnerabilityAssessmentsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_03_01_preview.DatabaseVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body DatabaseVulnerabilityAssessmentInner 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.v2017_03_01_preview.DatabaseVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v2017_03_01_preview.DatabaseVulnerabilityAssessments listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments") + 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.v2017_03_01_preview.DatabaseVulnerabilityAssessments listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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 database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested 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 serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String serverName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 deleteAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are 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<DatabaseVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with a 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseVulnerabilityAssessmentInner> 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); + } + + /** + * Lists the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessment policies associated with a 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 the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..d3f25ab94193a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesImpl.java @@ -0,0 +1,143 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Databases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ImportExportOperationResult; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Database; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ImportExportDatabaseDefinition; + +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 DatabaseImpl define(String name) { + return wrapModel(name); + } + + private DatabaseImpl wrapModel(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + + private DatabaseImpl wrapModel(String name) { + return new DatabaseImpl(name, this.manager()); + } + + @Override + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) { + DatabasesInner client = this.inner(); + return client.exportAsync(resourceGroupName, serverName, databaseName, parameters) + .map(new Func1() { + @Override + public ImportExportOperationResult call(ImportExportOperationResultInner inner) { + return new ImportExportOperationResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.pauseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.resumeAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + DatabasesInner client = this.inner(); + return client.renameAsync(resourceGroupName, serverName, databaseName, id).toCompletable(); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + DatabasesInner 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 Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..80b1d88edd755 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java @@ -0,0 +1,1881 @@ +/** + * 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.v2017_03_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.v2017_03_01_preview.DatabaseUpdate; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ImportExportDatabaseDefinition; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ResourceMoveDefinition; +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 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.v2017_03_01_preview.Databases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases") + 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.v2017_03_01_preview.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> get(@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.v2017_03_01_preview.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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.v2017_03_01_preview.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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.v2017_03_01_preview.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2017_03_01_preview.Databases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2017_03_01_preview.Databases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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.v2017_03_01_preview.Databases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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.v2017_03_01_preview.Databases export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ImportExportDatabaseDefinition 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.v2017_03_01_preview.Databases beginExport" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> beginExport(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ImportExportDatabaseDefinition 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.v2017_03_01_preview.Databases pause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> pause(@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.v2017_03_01_preview.Databases beginPause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> beginPause(@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.v2017_03_01_preview.Databases listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases") + Observable> listByElasticPool(@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.v2017_03_01_preview.Databases resume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> resume(@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.v2017_03_01_preview.Databases beginResume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> beginResume(@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.v2017_03_01_preview.Databases rename" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move") + Observable> rename(@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, @Body ResourceMoveDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.Databases listByServerNext" }) + @GET + Observable> listByServerNext(@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.v2017_03_01_preview.Databases listByElasticPoolNext" }) + @GET + Observable> listByElasticPoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of 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 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<DatabaseInner> 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 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 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> 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 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. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets 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. + * @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. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner 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."); + } + return service.get(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 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner 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); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner 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); + return service.beginCreateOrUpdate(resourceGroupName, serverName, 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 the 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. + * @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 databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes the 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. + * @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 databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(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."); + } + Observable> observable = service.delete(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the 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. + * @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 databaseName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes the 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. + * @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 databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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."); + } + return service.beginDelete(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 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate 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); + Observable> observable = service.update(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate 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); + return service.beginUpdate(resourceGroupName, serverName, 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); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @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 ImportExportOperationResultInner object if successful. + */ + public ImportExportOperationResultInner export(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @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 exportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportOperationResultInner>() { + @Override + public ImportExportOperationResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition 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); + Observable> observable = service.export(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @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 ImportExportOperationResultInner object if successful. + */ + public ImportExportOperationResultInner beginExport(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @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 beginExportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportOperationResultInner object + */ + public Observable beginExportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportOperationResultInner>() { + @Override + public ImportExportOperationResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports 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. + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportOperationResultInner object + */ + public Observable> beginExportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition 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); + return service.beginExport(resourceGroupName, serverName, 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 = beginExportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExportDelegate(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); + } + + /** + * Pauses 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 be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Pauses 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 be paused. + * @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 pauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> pauseWithServiceResponseAsync(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."); + } + Observable> observable = service.pause(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Pauses 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 be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginPause(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Pauses 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 be paused. + * @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 beginPauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginPauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginPauseWithServiceResponseAsync(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."); + } + return service.beginPause(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 clientResponse = beginPauseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPauseDelegate(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 databases in 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. + * @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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPool(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ServiceResponse> response = listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in 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. + * @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> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName) + .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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic 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 serverName The name of the server. + ServiceResponse> * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolSinglePageAsync(final String resourceGroupName, final String serverName, final 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.listByElasticPool(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> result = listByElasticPoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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); + } + + /** + * Resumes 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 be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Resumes 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 be resumed. + * @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 resumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resumeWithServiceResponseAsync(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."); + } + Observable> observable = service.resume(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Resumes 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 be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginResume(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Resumes 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 be resumed. + * @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 beginResumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginResumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginResumeWithServiceResponseAsync(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."); + } + return service.beginResume(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 clientResponse = beginResumeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResumeDelegate(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); + } + + /** + * Renames 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 rename. + * @param id The target ID for the 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 + */ + public void rename(String resourceGroupName, String serverName, String databaseName, String id) { + renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).toBlocking().single().body(); + } + + /** + * Renames 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 rename. + * @param id The target ID for the 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 renameAsync(String resourceGroupName, String serverName, String databaseName, String id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id), serviceCallback); + } + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> renameWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String id) { + 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."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + ResourceMoveDefinition parameters = new ResourceMoveDefinition(); + parameters.withId(id); + return service.rename(resourceGroupName, serverName, 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 = renameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse renameDelegate(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 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<DatabaseInner> 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 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> 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 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<DatabaseInner> 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 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<DatabaseInner> 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 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<DatabaseInner> 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); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPoolNext(final String nextPageLink) { + ServiceResponse> response = listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in an elastic 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> listByElasticPoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object + */ + public Observable> listByElasticPoolNextAsync(final String nextPageLink) { + return listByElasticPoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object + */ + public Observable>> listByElasticPoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionImpl.java new file mode 100644 index 0000000000000..07c1e0d149361 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecution; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ProvisioningState; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionTarget; + +class ExecutionJobJobAgentServerJobExecutionImpl extends IndexableRefreshableWrapperImpl implements ExecutionJobJobAgentServerJobExecution { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private UUID jobExecutionId; + private String stepName; + + ExecutionJobJobAgentServerJobExecutionImpl(JobExecutionInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.jobExecutionId = IdParsingUtils.getValueFromIdByName(inner.id(), "executions"); + this.stepName = IdParsingUtils.getValueFromIdByName(inner.id(), "steps"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + JobStepExecutionsInner client = this.manager().inner().jobStepExecutions(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobExecutionId, this.stepName); + } + + + + @Override + public DateTime createTime() { + return this.inner().createTime(); + } + + @Override + public Integer currentAttempts() { + return this.inner().currentAttempts(); + } + + @Override + public DateTime currentAttemptStartTime() { + return this.inner().currentAttemptStartTime(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public UUID jobExecutionId() { + return this.inner().jobExecutionId(); + } + + @Override + public Integer jobVersion() { + return this.inner().jobVersion(); + } + + @Override + public String lastMessage() { + return this.inner().lastMessage(); + } + + @Override + public JobExecutionLifecycle lifecycle() { + return this.inner().lifecycle(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String stepName() { + return this.inner().stepName(); + } + + @Override + public JobExecutionTarget target() { + return this.inner().target(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java new file mode 100644 index 0000000000000..12e57d6f0e3c0 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java @@ -0,0 +1,115 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecutionModel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ProvisioningState; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionTarget; + +class ExecutionJobJobAgentServerJobExecutionModelImpl extends WrapperImpl implements ExecutionJobJobAgentServerJobExecutionModel { + private final SqlManager manager; + + ExecutionJobJobAgentServerJobExecutionModelImpl(JobExecutionInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime createTime() { + return this.inner().createTime(); + } + + @Override + public Integer currentAttempts() { + return this.inner().currentAttempts(); + } + + @Override + public DateTime currentAttemptStartTime() { + return this.inner().currentAttemptStartTime(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public UUID jobExecutionId() { + return this.inner().jobExecutionId(); + } + + @Override + public Integer jobVersion() { + return this.inner().jobVersion(); + } + + @Override + public String lastMessage() { + return this.inner().lastMessage(); + } + + @Override + public JobExecutionLifecycle lifecycle() { + return this.inner().lifecycle(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String stepName() { + return this.inner().stepName(); + } + + @Override + public JobExecutionTarget target() { + return this.inner().target(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..c9098cb98a5fd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicy; + +class ExtendedDatabaseBlobAuditingPoliciesImpl extends WrapperImpl implements ExtendedDatabaseBlobAuditingPolicies { + private final SqlManager manager; + + ExtendedDatabaseBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().extendedDatabaseBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private ExtendedDatabaseBlobAuditingPolicyImpl wrapModel(ExtendedDatabaseBlobAuditingPolicyInner inner) { + return new ExtendedDatabaseBlobAuditingPolicyImpl(inner, manager()); + } + + private ExtendedDatabaseBlobAuditingPolicyImpl wrapModel(String name) { + return new ExtendedDatabaseBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public ExtendedDatabaseBlobAuditingPolicy call(ExtendedDatabaseBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..0c36196f92369 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ExtendedDatabaseBlobAuditingPolicies. + */ +public class ExtendedDatabaseBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ExtendedDatabaseBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedDatabaseBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ExtendedDatabaseBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ExtendedDatabaseBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ExtendedDatabaseBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ExtendedDatabaseBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ExtendedDatabaseBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an extended database's blob auditing 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. + * @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 ExtendedDatabaseBlobAuditingPolicyInner object if successful. + */ + public ExtendedDatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets an extended database's blob auditing 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. + * @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 an extended database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, ExtendedDatabaseBlobAuditingPolicyInner>() { + @Override + public ExtendedDatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an extended database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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 an extended database's blob auditing 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. + * @param parameters The extended database blob auditing 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 ExtendedDatabaseBlobAuditingPolicyInner object if successful. + */ + public ExtendedDatabaseBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an extended database's blob auditing 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. + * @param parameters The extended database blob auditing 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, ExtendedDatabaseBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates an extended database's blob auditing 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. + * @param parameters The extended database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ExtendedDatabaseBlobAuditingPolicyInner>() { + @Override + public ExtendedDatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an extended database's blob auditing 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. + * @param parameters The extended database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExtendedDatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..3ff030688a578 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,197 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class ExtendedDatabaseBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements ExtendedDatabaseBlobAuditingPolicy, ExtendedDatabaseBlobAuditingPolicy.Definition, ExtendedDatabaseBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + ExtendedDatabaseBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new ExtendedDatabaseBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ExtendedDatabaseBlobAuditingPolicyImpl(ExtendedDatabaseBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String predicateExpression() { + return this.inner().predicateExpression(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.inner().withPredicateExpression(predicateExpression); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..4da56c80b6d65 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,454 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An extended database blob auditing policy. + */ +@JsonFlatten +public class ExtendedDatabaseBlobAuditingPolicyInner extends ProxyResource { + /** + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "properties.predicateExpression") + private String predicateExpression; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..ea2f6763bf3a1 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedServerBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedServerBlobAuditingPolicy; + +class ExtendedServerBlobAuditingPoliciesImpl extends WrapperImpl implements ExtendedServerBlobAuditingPolicies { + private final SqlManager manager; + + ExtendedServerBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().extendedServerBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private ExtendedServerBlobAuditingPolicyImpl wrapModel(ExtendedServerBlobAuditingPolicyInner inner) { + return new ExtendedServerBlobAuditingPolicyImpl(inner, manager()); + } + + private ExtendedServerBlobAuditingPolicyImpl wrapModel(String name) { + return new ExtendedServerBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ExtendedServerBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ExtendedServerBlobAuditingPolicy call(ExtendedServerBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..054eb61e81ee9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ExtendedServerBlobAuditingPolicies. + */ +public class ExtendedServerBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ExtendedServerBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedServerBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ExtendedServerBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ExtendedServerBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ExtendedServerBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ExtendedServerBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedServerBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v2017_03_01_preview.ExtendedServerBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ExtendedServerBlobAuditingPolicyInner 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.v2017_03_01_preview.ExtendedServerBlobAuditingPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ExtendedServerBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an extended server's blob auditing 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. + * @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 ExtendedServerBlobAuditingPolicyInner object if successful. + */ + public ExtendedServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets an extended server's blob auditing 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 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 an extended server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ExtendedServerBlobAuditingPolicyInner>() { + @Override + public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an extended server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, blobAuditingPolicyName, 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 an extended server's blob auditing 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 parameters Properties of extended blob auditing 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 ExtendedServerBlobAuditingPolicyInner object if successful. + */ + public ExtendedServerBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing 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, ExtendedServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ExtendedServerBlobAuditingPolicyInner>() { + @Override + public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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 extended server's blob auditing 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 parameters Properties of extended blob auditing 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 ExtendedServerBlobAuditingPolicyInner object if successful. + */ + public ExtendedServerBlobAuditingPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ExtendedServerBlobAuditingPolicyInner>() { + @Override + public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..0d8db56e47f48 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyImpl.java @@ -0,0 +1,194 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedServerBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class ExtendedServerBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements ExtendedServerBlobAuditingPolicy, ExtendedServerBlobAuditingPolicy.Definition, ExtendedServerBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ExtendedServerBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new ExtendedServerBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ExtendedServerBlobAuditingPolicyImpl(ExtendedServerBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ExtendedServerBlobAuditingPoliciesInner client = this.manager().inner().extendedServerBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ExtendedServerBlobAuditingPoliciesInner client = this.manager().inner().extendedServerBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ExtendedServerBlobAuditingPoliciesInner client = this.manager().inner().extendedServerBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String predicateExpression() { + return this.inner().predicateExpression(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.inner().withPredicateExpression(predicateExpression); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..c42417db23e1d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedServerBlobAuditingPolicyInner.java @@ -0,0 +1,454 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An extended server blob auditing policy. + */ +@JsonFlatten +public class ExtendedServerBlobAuditingPolicyInner extends ProxyResource { + /** + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "properties.predicateExpression") + private String predicateExpression; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/IdParsingUtils.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..244b24d3675ac --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2017_03_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultImpl.java new file mode 100644 index 0000000000000..8410c3554bac2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultImpl.java @@ -0,0 +1,87 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ImportExportOperationResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.UUID; + +class ImportExportOperationResultImpl extends WrapperImpl implements ImportExportOperationResult { + private final SqlManager manager; + ImportExportOperationResultImpl(ImportExportOperationResultInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String blobUri() { + return this.inner().blobUri(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String queuedTime() { + return this.inner().queuedTime(); + } + + @Override + public UUID requestId() { + return this.inner().requestId(); + } + + @Override + public String requestType() { + return this.inner().requestType(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultInner.java new file mode 100644 index 0000000000000..8e4588f4169c4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ImportExportOperationResultInner.java @@ -0,0 +1,156 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An ImportExport operation result resource. + */ +@JsonFlatten +public class ImportExportOperationResultInner extends ProxyResource { + /** + * Request Id. + */ + @JsonProperty(value = "properties.requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /** + * Request type. + */ + @JsonProperty(value = "properties.requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /** + * Queued time. + */ + @JsonProperty(value = "properties.queuedTime", access = JsonProperty.Access.WRITE_ONLY) + private String queuedTime; + + /** + * Last modified time. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /** + * Blob Uri. + */ + @JsonProperty(value = "properties.blobUri", access = JsonProperty.Access.WRITE_ONLY) + private String blobUri; + + /** + * Server name. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * Database name. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * Operation status. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Error message. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * Get request Id. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get request type. + * + * @return the requestType value + */ + public String requestType() { + return this.requestType; + } + + /** + * Get queued time. + * + * @return the queuedTime value + */ + public String queuedTime() { + return this.queuedTime; + } + + /** + * Get last modified time. + * + * @return the lastModifiedTime value + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get blob Uri. + * + * @return the blobUri value + */ + public String blobUri() { + return this.blobUri; + } + + /** + * Get server name. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get operation status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get error message. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentImpl.java new file mode 100644 index 0000000000000..7514f3c36bed6 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentImpl.java @@ -0,0 +1,146 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgent; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgentState; + +class JobAgentImpl extends CreatableUpdatableImpl implements JobAgent, JobAgent.Definition, JobAgent.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + + JobAgentImpl(String name, SqlManager manager) { + super(name, new JobAgentInner()); + this.manager = manager; + // Set resource name + this.jobAgentName = name; + // + } + + JobAgentImpl(JobAgentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.jobAgentName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobAgentsInner client = this.manager().inner().jobAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobAgentsInner client = this.manager().inner().jobAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobAgentsInner client = this.manager().inner().jobAgents(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String databaseId() { + return this.inner().databaseId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public JobAgentState state() { + return this.inner().state(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public JobAgentImpl withDatabaseId(String databaseId) { + this.inner().withDatabaseId(databaseId); + return this; + } + + @Override + public JobAgentImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public JobAgentImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + + @Override + public JobAgentImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentInner.java new file mode 100644 index 0000000000000..5c65f6a501f6c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentInner.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL job agent. + */ +@JsonFlatten +public class JobAgentInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Resource ID of the database to store job metadata in. + */ + @JsonProperty(value = "properties.databaseId", required = true) + private String databaseId; + + /** + * The state of the job agent. Possible values include: 'Creating', + * 'Ready', 'Updating', 'Deleting', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private JobAgentState state; + + /** + * 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 JobAgentInner object itself. + */ + public JobAgentInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get resource ID of the database to store job metadata in. + * + * @return the databaseId value + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Set resource ID of the database to store job metadata in. + * + * @param databaseId the databaseId value to set + * @return the JobAgentInner object itself. + */ + public JobAgentInner withDatabaseId(String databaseId) { + this.databaseId = databaseId; + return this; + } + + /** + * Get the state of the job agent. Possible values include: 'Creating', 'Ready', 'Updating', 'Deleting', 'Disabled'. + * + * @return the state value + */ + public JobAgentState state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentServerJobExecutionImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentServerJobExecutionImpl.java new file mode 100644 index 0000000000000..48903327fe0c1 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentServerJobExecutionImpl.java @@ -0,0 +1,170 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgentServerJobExecution; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.UUID; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ProvisioningState; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionTarget; + +class JobAgentServerJobExecutionImpl extends CreatableUpdatableImpl implements JobAgentServerJobExecution, JobAgentServerJobExecution.Definition, JobAgentServerJobExecution.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private UUID jobExecutionId; + + JobAgentServerJobExecutionImpl(String name, SqlManager manager) { + super(name, new JobExecutionInner()); + this.manager = manager; + // Set resource name + this.jobExecutionId = name; + // + } + + JobAgentServerJobExecutionImpl(JobExecutionInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.jobExecutionId = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.jobExecutionId = IdParsingUtils.getValueFromIdByName(inner.id(), "executions"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobExecutionsInner client = this.manager().inner().jobExecutions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobExecutionId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobExecutionsInner client = this.manager().inner().jobExecutions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobExecutionId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobExecutionsInner client = this.manager().inner().jobExecutions(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createTime() { + return this.inner().createTime(); + } + + @Override + public Integer currentAttempts() { + return this.inner().currentAttempts(); + } + + @Override + public DateTime currentAttemptStartTime() { + return this.inner().currentAttemptStartTime(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public UUID jobExecutionId() { + return this.inner().jobExecutionId(); + } + + @Override + public Integer jobVersion() { + return this.inner().jobVersion(); + } + + @Override + public String lastMessage() { + return this.inner().lastMessage(); + } + + @Override + public JobExecutionLifecycle lifecycle() { + return this.inner().lifecycle(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String stepName() { + return this.inner().stepName(); + } + + @Override + public JobExecutionTarget target() { + return this.inner().target(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobAgentServerJobExecutionImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + this.jobName = jobName; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsImpl.java new file mode 100644 index 0000000000000..dabf258deb53d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgents; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgent; + +class JobAgentsImpl extends WrapperImpl implements JobAgents { + private final SqlManager manager; + + JobAgentsImpl(SqlManager manager) { + super(manager.inner().jobAgents()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobAgentImpl define(String name) { + return wrapModel(name); + } + + private JobAgentImpl wrapModel(JobAgentInner inner) { + return new JobAgentImpl(inner, manager()); + } + + private JobAgentImpl wrapModel(String name) { + return new JobAgentImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + JobAgentsInner 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 JobAgent call(JobAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName) { + JobAgentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1() { + @Override + public JobAgent call(JobAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + JobAgentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java new file mode 100644 index 0000000000000..dd544f884e6b2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java @@ -0,0 +1,1139 @@ +/** + * 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.v2017_03_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.v2017_03_01_preview.JobAgentUpdate; +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 JobAgents. + */ +public class JobAgentsInner { + /** The Retrofit service to perform REST calls. */ + private JobAgentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobAgentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobAgentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobAgentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobAgents to be + * used by Retrofit to perform actually REST calls. + */ + interface JobAgentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgents listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents") + 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.v2017_03_01_preview.JobAgents get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v2017_03_01_preview.JobAgents createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Body JobAgentInner 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.v2017_03_01_preview.JobAgents beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Body JobAgentInner 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.v2017_03_01_preview.JobAgents delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v2017_03_01_preview.JobAgents beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v2017_03_01_preview.JobAgents update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobAgentUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgents beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobAgentUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgents listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of job agents in 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<JobAgentInner> 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 job agents in 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 a list of job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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 a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner get(String resourceGroupName, String serverName, String jobAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 getAsync(String resourceGroupName, String serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 serverName, String jobAgentName, JobAgentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters), serviceCallback); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 serverName, String jobAgentName, JobAgentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters), serviceCallback); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().last().body(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().last().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String jobAgentName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(null); + Observable> observable = service.update(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).toBlocking().last().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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); + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(tags); + Observable> observable = service.update(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner beginUpdate(String resourceGroupName, String serverName, String jobAgentName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(null); + return service.beginUpdate(resourceGroupName, serverName, jobAgentName, 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 a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner beginUpdate(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).toBlocking().single().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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); + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(tags); + return service.beginUpdate(resourceGroupName, serverName, jobAgentName, 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 job agents in 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<JobAgentInner> 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 job agents in 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 a list of job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialImpl.java new file mode 100644 index 0000000000000..0790b14303ca5 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialImpl.java @@ -0,0 +1,119 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobCredential; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class JobCredentialImpl extends CreatableUpdatableImpl implements JobCredential, JobCredential.Definition, JobCredential.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String credentialName; + + JobCredentialImpl(String name, SqlManager manager) { + super(name, new JobCredentialInner()); + this.manager = manager; + // Set resource name + this.credentialName = name; + // + } + + JobCredentialImpl(JobCredentialInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.credentialName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.credentialName = IdParsingUtils.getValueFromIdByName(inner.id(), "credentials"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobCredentialsInner client = this.manager().inner().jobCredentials(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.credentialName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobCredentialsInner client = this.manager().inner().jobCredentials(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.credentialName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobCredentialsInner client = this.manager().inner().jobCredentials(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.credentialName); + } + + @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 String password() { + return this.inner().password(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String username() { + return this.inner().username(); + } + + @Override + public JobCredentialImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + @Override + public JobCredentialImpl withPassword(String password) { + this.inner().withPassword(password); + return this; + } + + @Override + public JobCredentialImpl withUsername(String username) { + this.inner().withUsername(username); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialInner.java new file mode 100644 index 0000000000000..8f3f0ae1e2036 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialInner.java @@ -0,0 +1,73 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A stored credential that can be used by a job to connect to target + * databases. + */ +@JsonFlatten +public class JobCredentialInner extends ProxyResource { + /** + * The credential user name. + */ + @JsonProperty(value = "properties.username", required = true) + private String username; + + /** + * The credential password. + */ + @JsonProperty(value = "properties.password", required = true) + private String password; + + /** + * Get the credential user name. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set the credential user name. + * + * @param username the username value to set + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the credential password. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the credential password. + * + * @param password the password value to set + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsImpl.java new file mode 100644 index 0000000000000..c67803b9f6040 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobCredentials; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobCredential; + +class JobCredentialsImpl extends WrapperImpl implements JobCredentials { + private final SqlManager manager; + + JobCredentialsImpl(SqlManager manager) { + super(manager.inner().jobCredentials()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobCredentialImpl define(String name) { + return wrapModel(name); + } + + private JobCredentialImpl wrapModel(JobCredentialInner inner) { + return new JobCredentialImpl(inner, manager()); + } + + private JobCredentialImpl wrapModel(String name) { + return new JobCredentialImpl(name, this.manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobCredentialsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobCredential call(JobCredentialInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + JobCredentialsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, credentialName) + .map(new Func1() { + @Override + public JobCredential call(JobCredentialInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + JobCredentialsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, credentialName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java new file mode 100644 index 0000000000000..7851b9e049025 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java @@ -0,0 +1,637 @@ +/** + * 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.v2017_03_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 JobCredentials. + */ +public class JobCredentialsInner { + /** The Retrofit service to perform REST calls. */ + private JobCredentialsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobCredentialsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobCredentialsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobCredentialsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobCredentials to be + * used by Retrofit to perform actually REST calls. + */ + interface JobCredentialsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobCredentials listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v2017_03_01_preview.JobCredentials get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @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.v2017_03_01_preview.JobCredentials createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @Path("subscriptionId") String subscriptionId, @Body JobCredentialInner 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.v2017_03_01_preview.JobCredentials delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @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.v2017_03_01_preview.JobCredentials listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobCredentialInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobCredentialInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, 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 = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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 jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 JobCredentialInner object if successful. + */ + public JobCredentialInner get(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).toBlocking().single().body(); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobAgentName, String credentialName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName), serviceCallback); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1, JobCredentialInner>() { + @Override + public JobCredentialInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName 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, jobAgentName, credentialName, 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 job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential 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 JobCredentialInner object if successful. + */ + public JobCredentialInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential 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 serverName, String jobAgentName, String credentialName, JobCredentialInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters), serviceCallback); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).map(new Func1, JobCredentialInner>() { + @Override + public JobCredentialInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, credentialName, 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 a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobAgentName, String credentialName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).toBlocking().single().body(); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobAgentName, String credentialName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName), serviceCallback); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName 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.delete(resourceGroupName, serverName, jobAgentName, credentialName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of jobs credentials. + * + * @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<JobCredentialInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs credentials. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs credentials. + * + * @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<JobCredentialInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + * @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<JobCredentialInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobCredentialInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionInner.java new file mode 100644 index 0000000000000..b9c09603c0306 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionInner.java @@ -0,0 +1,235 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ProvisioningState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutionTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An execution of a job. + */ +@JsonFlatten +public class JobExecutionInner extends ProxyResource { + /** + * The job version number. + */ + @JsonProperty(value = "properties.jobVersion", access = JsonProperty.Access.WRITE_ONLY) + private Integer jobVersion; + + /** + * The job step name. + */ + @JsonProperty(value = "properties.stepName", access = JsonProperty.Access.WRITE_ONLY) + private String stepName; + + /** + * The job step id. + */ + @JsonProperty(value = "properties.stepId", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepId; + + /** + * The unique identifier of the job execution. + */ + @JsonProperty(value = "properties.jobExecutionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID jobExecutionId; + + /** + * The detailed state of the job execution. Possible values include: + * 'Created', 'InProgress', 'WaitingForChildJobExecutions', + * 'WaitingForRetry', 'Succeeded', 'SucceededWithSkipped', 'Failed', + * 'TimedOut', 'Canceled', 'Skipped'. + */ + @JsonProperty(value = "properties.lifecycle", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionLifecycle lifecycle; + + /** + * The ARM provisioning state of the job execution. Possible values + * include: 'Created', 'InProgress', 'Succeeded', 'Failed', 'Canceled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The time that the job execution was created. + */ + @JsonProperty(value = "properties.createTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createTime; + + /** + * The time that the job execution started. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The time that the job execution completed. + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * Number of times the job execution has been attempted. + */ + @JsonProperty(value = "properties.currentAttempts") + private Integer currentAttempts; + + /** + * Start time of the current attempt. + */ + @JsonProperty(value = "properties.currentAttemptStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime currentAttemptStartTime; + + /** + * The last status or error message. + */ + @JsonProperty(value = "properties.lastMessage", access = JsonProperty.Access.WRITE_ONLY) + private String lastMessage; + + /** + * The target that this execution is executed on. + */ + @JsonProperty(value = "properties.target", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionTarget target; + + /** + * Get the job version number. + * + * @return the jobVersion value + */ + public Integer jobVersion() { + return this.jobVersion; + } + + /** + * Get the job step name. + * + * @return the stepName value + */ + public String stepName() { + return this.stepName; + } + + /** + * Get the job step id. + * + * @return the stepId value + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Get the unique identifier of the job execution. + * + * @return the jobExecutionId value + */ + public UUID jobExecutionId() { + return this.jobExecutionId; + } + + /** + * Get the detailed state of the job execution. Possible values include: 'Created', 'InProgress', 'WaitingForChildJobExecutions', 'WaitingForRetry', 'Succeeded', 'SucceededWithSkipped', 'Failed', 'TimedOut', 'Canceled', 'Skipped'. + * + * @return the lifecycle value + */ + public JobExecutionLifecycle lifecycle() { + return this.lifecycle; + } + + /** + * Get the ARM provisioning state of the job execution. Possible values include: 'Created', 'InProgress', 'Succeeded', 'Failed', 'Canceled'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the time that the job execution was created. + * + * @return the createTime value + */ + public DateTime createTime() { + return this.createTime; + } + + /** + * Get the time that the job execution started. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the time that the job execution completed. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get number of times the job execution has been attempted. + * + * @return the currentAttempts value + */ + public Integer currentAttempts() { + return this.currentAttempts; + } + + /** + * Set number of times the job execution has been attempted. + * + * @param currentAttempts the currentAttempts value to set + * @return the JobExecutionInner object itself. + */ + public JobExecutionInner withCurrentAttempts(Integer currentAttempts) { + this.currentAttempts = currentAttempts; + return this; + } + + /** + * Get start time of the current attempt. + * + * @return the currentAttemptStartTime value + */ + public DateTime currentAttemptStartTime() { + return this.currentAttemptStartTime; + } + + /** + * Get the last status or error message. + * + * @return the lastMessage value + */ + public String lastMessage() { + return this.lastMessage; + } + + /** + * Get the target that this execution is executed on. + * + * @return the target value + */ + public JobExecutionTarget target() { + return this.target; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsImpl.java new file mode 100644 index 0000000000000..5af4933b6cbdc --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsImpl.java @@ -0,0 +1,112 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgentServerJobExecution; +import rx.Completable; +import java.util.UUID; + +class JobExecutionsImpl extends WrapperImpl implements JobExecutions { + private final SqlManager manager; + + JobExecutionsImpl(SqlManager manager) { + super(manager.inner().jobExecutions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobAgentServerJobExecutionImpl defineExecution(String name) { + return wrapExecutionModel(name); + } + + private JobAgentServerJobExecutionImpl wrapExecutionModel(String name) { + return new JobAgentServerJobExecutionImpl(name, this.manager()); + } + + private JobAgentServerJobExecutionImpl wrapJobAgentServerJobExecutionModel(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobExecutionsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return wrapJobAgentServerJobExecutionModel(inner); + } + }); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toCompletable(); + } + + @Override + public Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + JobExecutionsInner client = this.inner(); + return client.listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobExecutionsInner client = this.inner(); + return client.createAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java new file mode 100644 index 0000000000000..b697ccfe6a54d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java @@ -0,0 +1,1534 @@ +/** + * 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.v2017_03_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 org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 JobExecutions. + */ +public class JobExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutions listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/executions") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v2017_03_01_preview.JobExecutions cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v2017_03_01_preview.JobExecutions create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v2017_03_01_preview.JobExecutions beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v2017_03_01_preview.JobExecutions listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v2017_03_01_preview.JobExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v2017_03_01_preview.JobExecutions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v2017_03_01_preview.JobExecutions beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v2017_03_01_preview.JobExecutions listByAgentNext" }) + @GET + Observable> listByAgentNext(@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.v2017_03_01_preview.JobExecutions listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancel(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.cancel(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().last().body(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.create(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner beginCreate(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.beginCreate(resourceGroupName, serverName, jobAgentName, jobName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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 a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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 job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @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 jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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, jobAgentName, jobName, jobExecutionId, 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 updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().last().body(); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.beginCreateOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, 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 = 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); + } + + /** + * Lists all executions in a job agent. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @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<JobExecutionInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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 a job's executions. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @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> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @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<JobExecutionInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(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.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobImpl.java new file mode 100644 index 0000000000000..9a7c2031b4c4f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobImpl.java @@ -0,0 +1,125 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.Job; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobSchedule; + +class JobImpl extends CreatableUpdatableImpl implements Job, Job.Definition, Job.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + + JobImpl(String name, SqlManager manager) { + super(name, new JobInner()); + this.manager = manager; + // Set resource name + this.jobName = name; + // + } + + JobImpl(JobInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.jobName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobsInner client = this.manager().inner().jobs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobsInner client = this.manager().inner().jobs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobsInner client = this.manager().inner().jobs(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public JobSchedule schedule() { + return this.inner().schedule(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Integer version() { + return this.inner().version(); + } + + @Override + public JobImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + @Override + public JobImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public JobImpl withSchedule(JobSchedule schedule) { + this.inner().withSchedule(schedule); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobInner.java new file mode 100644 index 0000000000000..366e2624eb4b1 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobInner.java @@ -0,0 +1,88 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobSchedule; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A job. + */ +@JsonFlatten +public class JobInner extends ProxyResource { + /** + * User-defined description of the job. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The job version number. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /** + * Schedule properties of the job. + */ + @JsonProperty(value = "properties.schedule") + private JobSchedule schedule; + + /** + * Get user-defined description of the job. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set user-defined description of the job. + * + * @param description the description value to set + * @return the JobInner object itself. + */ + public JobInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the job version number. + * + * @return the version value + */ + public Integer version() { + return this.version; + } + + /** + * Get schedule properties of the job. + * + * @return the schedule value + */ + public JobSchedule schedule() { + return this.schedule; + } + + /** + * Set schedule properties of the job. + * + * @param schedule the schedule value to set + * @return the JobInner object itself. + */ + public JobInner withSchedule(JobSchedule schedule) { + this.schedule = schedule; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.java new file mode 100644 index 0000000000000..5ac2072640dae --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepExecutions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecution; +import com.microsoft.azure.Page; + +class JobStepExecutionsImpl extends WrapperImpl implements JobStepExecutions { + private final SqlManager manager; + + JobStepExecutionsImpl(SqlManager manager) { + super(manager.inner().jobStepExecutions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ExecutionJobJobAgentServerJobExecutionImpl wrapExecutionJobJobAgentServerJobExecutionModel(JobExecutionInner inner) { + return new ExecutionJobJobAgentServerJobExecutionImpl(inner, manager()); + } + + private Observable getJobExecutionInnerUsingJobStepExecutionsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + String jobAgentName = IdParsingUtils.getValueFromIdByName(id, "jobAgents"); + String jobName = IdParsingUtils.getValueFromIdByName(id, "jobs"); + String jobExecutionId = IdParsingUtils.getValueFromIdByName(id, "executions"); + String stepName = IdParsingUtils.getValueFromIdByName(id, "steps"); + JobStepExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + JobStepExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .map(new Func1() { + @Override + public ExecutionJobJobAgentServerJobExecution call(JobExecutionInner inner) { + return wrapExecutionJobJobAgentServerJobExecutionModel(inner); + } + }); + } + + @Override + public Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + JobStepExecutionsInner client = this.inner(); + return client.listByJobExecutionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ExecutionJobJobAgentServerJobExecution call(JobExecutionInner inner) { + return wrapExecutionJobJobAgentServerJobExecutionModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsInner.java new file mode 100644 index 0000000000000..81d9f640ba5c2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsInner.java @@ -0,0 +1,630 @@ +/** + * 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.v2017_03_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 org.joda.time.DateTime; +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 JobStepExecutions. + */ +public class JobStepExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobStepExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobStepExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobStepExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobStepExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobStepExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepExecutions listByJobExecution" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps") + Observable> listByJobExecution(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v2017_03_01_preview.JobStepExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @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.v2017_03_01_preview.JobStepExecutions listByJobExecutionNext" }) + @GET + Observable> listByJobExecutionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionDelegate(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 step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).toBlocking().single().body(); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @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 jobAgentName, String jobName, UUID jobExecutionId, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName), serviceCallback); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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, jobAgentName, jobName, jobExecutionId, stepName, 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); + } + + /** + * Lists the step executions of a job execution. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecutionNext(final String nextPageLink) { + ServiceResponse> response = listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @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> listByJobExecutionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable> listByJobExecutionNextAsync(final String nextPageLink) { + return listByJobExecutionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByJobExecutionNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionNextSinglePageAsync(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.listByJobExecutionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.java new file mode 100644 index 0000000000000..c1fb8a1c74b71 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStep; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepAction; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepOutput; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepExecutionOptions; + +class JobStepImpl extends CreatableUpdatableImpl implements JobStep, JobStep.Definition, JobStep.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private String stepName; + + JobStepImpl(String name, SqlManager manager) { + super(name, new JobStepInner()); + this.manager = manager; + // Set resource name + this.stepName = name; + // + } + + JobStepImpl(JobStepInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.stepName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.stepName = IdParsingUtils.getValueFromIdByName(inner.id(), "steps"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobStepsInner client = this.manager().inner().jobSteps(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobStepsInner client = this.manager().inner().jobSteps(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobStepsInner client = this.manager().inner().jobSteps(); + return client.getByVersionAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public JobStepAction action() { + return this.inner().action(); + } + + @Override + public String credential() { + return this.inner().credential(); + } + + @Override + public JobStepExecutionOptions executionOptions() { + return this.inner().executionOptions(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public JobStepOutput output() { + return this.inner().output(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String targetGroup() { + return this.inner().targetGroup(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobStepImpl withExistingVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + this.jobName = jobName; + return this; + } + + @Override + public JobStepImpl withAction(JobStepAction action) { + this.inner().withAction(action); + return this; + } + + @Override + public JobStepImpl withCredential(String credential) { + this.inner().withCredential(credential); + return this; + } + + @Override + public JobStepImpl withTargetGroup(String targetGroup) { + this.inner().withTargetGroup(targetGroup); + return this; + } + + @Override + public JobStepImpl withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.inner().withExecutionOptions(executionOptions); + return this; + } + + @Override + public JobStepImpl withOutput(JobStepOutput output) { + this.inner().withOutput(output); + return this; + } + + @Override + public JobStepImpl withStepId(Integer stepId) { + this.inner().withStepId(stepId); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepInner.java new file mode 100644 index 0000000000000..92530be66507a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepInner.java @@ -0,0 +1,183 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepAction; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepOutput; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepExecutionOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A job step. + */ +@JsonFlatten +public class JobStepInner extends ProxyResource { + /** + * The job step's index within the job. If not specified when creating the + * job step, it will be created as the last step. If not specified when + * updating the job step, the step id is not modified. + */ + @JsonProperty(value = "properties.stepId") + private Integer stepId; + + /** + * The resource ID of the target group that the job step will be executed + * on. + */ + @JsonProperty(value = "properties.targetGroup", required = true) + private String targetGroup; + + /** + * The resource ID of the job credential that will be used to connect to + * the targets. + */ + @JsonProperty(value = "properties.credential", required = true) + private String credential; + + /** + * The action payload of the job step. + */ + @JsonProperty(value = "properties.action", required = true) + private JobStepAction action; + + /** + * Output destination properties of the job step. + */ + @JsonProperty(value = "properties.output") + private JobStepOutput output; + + /** + * Execution options for the job step. + */ + @JsonProperty(value = "properties.executionOptions") + private JobStepExecutionOptions executionOptions; + + /** + * Get the job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. + * + * @return the stepId value + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Set the job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. + * + * @param stepId the stepId value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withStepId(Integer stepId) { + this.stepId = stepId; + return this; + } + + /** + * Get the resource ID of the target group that the job step will be executed on. + * + * @return the targetGroup value + */ + public String targetGroup() { + return this.targetGroup; + } + + /** + * Set the resource ID of the target group that the job step will be executed on. + * + * @param targetGroup the targetGroup value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withTargetGroup(String targetGroup) { + this.targetGroup = targetGroup; + return this; + } + + /** + * Get the resource ID of the job credential that will be used to connect to the targets. + * + * @return the credential value + */ + public String credential() { + return this.credential; + } + + /** + * Set the resource ID of the job credential that will be used to connect to the targets. + * + * @param credential the credential value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withCredential(String credential) { + this.credential = credential; + return this; + } + + /** + * Get the action payload of the job step. + * + * @return the action value + */ + public JobStepAction action() { + return this.action; + } + + /** + * Set the action payload of the job step. + * + * @param action the action value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withAction(JobStepAction action) { + this.action = action; + return this; + } + + /** + * Get output destination properties of the job step. + * + * @return the output value + */ + public JobStepOutput output() { + return this.output; + } + + /** + * Set output destination properties of the job step. + * + * @param output the output value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withOutput(JobStepOutput output) { + this.output = output; + return this; + } + + /** + * Get execution options for the job step. + * + * @return the executionOptions value + */ + public JobStepExecutionOptions executionOptions() { + return this.executionOptions; + } + + /** + * Set execution options for the job step. + * + * @param executionOptions the executionOptions value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.executionOptions = executionOptions; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsImpl.java new file mode 100644 index 0000000000000..03e17a0849459 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobSteps; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStep; + +class JobStepsImpl extends WrapperImpl implements JobSteps { + private final SqlManager manager; + + JobStepsImpl(SqlManager manager) { + super(manager.inner().jobSteps()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobStepImpl define(String name) { + return wrapModel(name); + } + + private JobStepImpl wrapModel(JobStepInner inner) { + return new JobStepImpl(inner, manager()); + } + + private JobStepImpl wrapModel(String name) { + return new JobStepImpl(name, this.manager()); + } + + @Override + public Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + JobStepsInner client = this.inner(); + return client.listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return new JobStepImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + JobStepsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return new JobStepImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + JobStepsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toCompletable(); + } + + @Override + public Observable listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + JobStepsInner client = this.inner(); + return client.listByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + JobStepsInner client = this.inner(); + return client.getByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java new file mode 100644 index 0000000000000..8f7f9555f165a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java @@ -0,0 +1,1044 @@ +/** + * 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.v2017_03_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 JobSteps. + */ +public class JobStepsInner { + /** The Retrofit service to perform REST calls. */ + private JobStepsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobStepsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobStepsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobSteps to be + * used by Retrofit to perform actually REST calls. + */ + interface JobStepsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobSteps listByVersion" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps") + Observable> listByVersion(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @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.v2017_03_01_preview.JobSteps getByVersion" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName}") + Observable> getByVersion(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @Path("stepName") String stepName, @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.v2017_03_01_preview.JobSteps listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v2017_03_01_preview.JobSteps get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @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.v2017_03_01_preview.JobSteps createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @Path("subscriptionId") String subscriptionId, @Body JobStepInner 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.v2017_03_01_preview.JobSteps delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @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.v2017_03_01_preview.JobSteps listByVersionNext" }) + @GET + Observable> listByVersionNext(@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.v2017_03_01_preview.JobSteps listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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<JobStepInner> object if successful. + */ + public PagedList listByVersion(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + ServiceResponse> response = listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + return listByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByVersionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + return listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .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(listByVersionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVersionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, 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 = listByVersionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVersionDelegate(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 specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner getByVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).toBlocking().single().body(); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName), serviceCallback); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> getByVersionWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.getByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, 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 = getByVersionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByVersionDelegate(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 all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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<JobStepInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByJob(resourceGroupName, serverName, jobAgentName, jobName, 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 = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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 job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toBlocking().single().body(); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 jobAgentName, String jobName, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName), serviceCallback); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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, jobAgentName, jobName, stepName, 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 job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 jobAgentName, String jobName, String stepName, JobStepInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters), serviceCallback); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, stepName, 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 a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 jobAgentName, String jobName, String stepName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toBlocking().single().body(); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 jobAgentName, String jobName, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName), serviceCallback); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.delete(resourceGroupName, serverName, jobAgentName, jobName, stepName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all job steps in the specified job version. + * + * @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<JobStepInner> object if successful. + */ + public PagedList listByVersionNext(final String nextPageLink) { + ServiceResponse> response = listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps in the specified job version. + * + * @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> listByVersionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVersionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps in the specified job version. + * + * @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<JobStepInner> object + */ + public Observable> listByVersionNextAsync(final String nextPageLink) { + return listByVersionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + * @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<JobStepInner> object + */ + public Observable>> listByVersionNextWithServiceResponseAsync(final String nextPageLink) { + return listByVersionNextSinglePageAsync(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(listByVersionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVersionNextSinglePageAsync(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.listByVersionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByVersionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVersionNextDelegate(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 job steps for a job's current version. + * + * @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<JobStepInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps for a job's current version. + * + * @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> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps for a job's current version. + * + * @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<JobStepInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + * @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<JobStepInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(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.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsImpl.java new file mode 100644 index 0000000000000..37b17a68d95f9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetExecutions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecutionModel; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgentServerJobExecution; +import java.util.UUID; + +class JobTargetExecutionsImpl extends WrapperImpl implements JobTargetExecutions { + private final SqlManager manager; + + JobTargetExecutionsImpl(SqlManager manager) { + super(manager.inner().jobTargetExecutions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ExecutionJobJobAgentServerJobExecutionModelImpl wrapExecutionJobJobAgentServerJobExecutionModelModel(JobExecutionInner inner) { + return new ExecutionJobJobAgentServerJobExecutionModelImpl(inner, manager()); + } + + @Override + public Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + JobTargetExecutionsInner client = this.inner(); + return client.listByJobExecutionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ExecutionJobJobAgentServerJobExecutionModel call(JobExecutionInner inner) { + return wrapExecutionJobJobAgentServerJobExecutionModelModel(inner); + } + }); + } + + @Override + public Observable listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + JobTargetExecutionsInner client = this.inner(); + return client.listByStepAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + JobTargetExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsInner.java new file mode 100644 index 0000000000000..b57133a6d1f35 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetExecutionsInner.java @@ -0,0 +1,1101 @@ +/** + * 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.v2017_03_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 org.joda.time.DateTime; +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 JobTargetExecutions. + */ +public class JobTargetExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobTargetExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobTargetExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobTargetExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobTargetExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobTargetExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetExecutions listByJobExecution" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/targets") + Observable> listByJobExecution(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v2017_03_01_preview.JobTargetExecutions listByStep" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets") + Observable> listByStep(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v2017_03_01_preview.JobTargetExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets/{targetId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @Path("targetId") UUID targetId, @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.v2017_03_01_preview.JobTargetExecutions listByJobExecutionNext" }) + @GET + Observable> listByJobExecutionNext(@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.v2017_03_01_preview.JobTargetExecutions listByStepNext" }) + @GET + Observable> listByStepNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionDelegate(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 target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByStep(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + ServiceResponse> response = listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @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> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByStepWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + return listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .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(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByStep(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByStepWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param stepName The name of the step. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByStepDelegate(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 target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId).toBlocking().single().body(); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @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 jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId), serviceCallback); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (targetId == null) { + throw new IllegalArgumentException("Parameter targetId 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, jobAgentName, jobName, jobExecutionId, stepName, targetId, 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); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecutionNext(final String nextPageLink) { + ServiceResponse> response = listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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> listByJobExecutionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable> listByJobExecutionNextAsync(final String nextPageLink) { + return listByJobExecutionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByJobExecutionNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionNextSinglePageAsync(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.listByJobExecutionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionNextDelegate(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 target executions of a job step execution. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByStepNext(final String nextPageLink) { + ServiceResponse> response = listByStepNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @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> listByStepNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @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<JobExecutionInner> object + */ + public Observable> listByStepNextAsync(final String nextPageLink) { + return listByStepNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByStepNextWithServiceResponseAsync(final String nextPageLink) { + return listByStepNextSinglePageAsync(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(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepNextSinglePageAsync(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.listByStepNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByStepNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupImpl.java new file mode 100644 index 0000000000000..e9adac03adedb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupImpl.java @@ -0,0 +1,116 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTarget; + +class JobTargetGroupImpl extends CreatableUpdatableImpl implements JobTargetGroup, JobTargetGroup.Definition, JobTargetGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String targetGroupName; + private List cmembers; + private List umembers; + + JobTargetGroupImpl(String name, SqlManager manager) { + super(name, new JobTargetGroupInner()); + this.manager = manager; + // Set resource name + this.targetGroupName = name; + // + } + + JobTargetGroupImpl(JobTargetGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.targetGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.targetGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "targetGroups"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobTargetGroupsInner client = this.manager().inner().jobTargetGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.targetGroupName, this.cmembers) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobTargetGroupsInner client = this.manager().inner().jobTargetGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.targetGroupName, this.umembers) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobTargetGroupsInner client = this.manager().inner().jobTargetGroups(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.targetGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List members() { + return this.inner().members(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobTargetGroupImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + @Override + public JobTargetGroupImpl withMembers(List members) { + if (isInCreateMode()) { + this.cmembers = members; + } else { + this.umembers = members; + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupInner.java new file mode 100644 index 0000000000000..496a99673487e --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupInner.java @@ -0,0 +1,48 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A group of job targets. + */ +@JsonFlatten +public class JobTargetGroupInner extends ProxyResource { + /** + * Members of the target group. + */ + @JsonProperty(value = "properties.members", required = true) + private List members; + + /** + * Get members of the target group. + * + * @return the members value + */ + public List members() { + return this.members; + } + + /** + * Set members of the target group. + * + * @param members the members value to set + * @return the JobTargetGroupInner object itself. + */ + public JobTargetGroupInner withMembers(List members) { + this.members = members; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsImpl.java new file mode 100644 index 0000000000000..d574efa807583 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetGroup; + +class JobTargetGroupsImpl extends WrapperImpl implements JobTargetGroups { + private final SqlManager manager; + + JobTargetGroupsImpl(SqlManager manager) { + super(manager.inner().jobTargetGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobTargetGroupImpl define(String name) { + return wrapModel(name); + } + + private JobTargetGroupImpl wrapModel(JobTargetGroupInner inner) { + return new JobTargetGroupImpl(inner, manager()); + } + + private JobTargetGroupImpl wrapModel(String name) { + return new JobTargetGroupImpl(name, this.manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobTargetGroupsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobTargetGroup call(JobTargetGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + JobTargetGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, targetGroupName) + .map(new Func1() { + @Override + public JobTargetGroup call(JobTargetGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + JobTargetGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java new file mode 100644 index 0000000000000..e7cee5a185ecd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java @@ -0,0 +1,640 @@ +/** + * 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.v2017_03_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.v2017_03_01_preview.JobTarget; +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 JobTargetGroups. + */ +public class JobTargetGroupsInner { + /** The Retrofit service to perform REST calls. */ + private JobTargetGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobTargetGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobTargetGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobTargetGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface JobTargetGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetGroups listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v2017_03_01_preview.JobTargetGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @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.v2017_03_01_preview.JobTargetGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobTargetGroupInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @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.v2017_03_01_preview.JobTargetGroups listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobTargetGroupInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all target groups in an agent. + * + 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobTargetGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, 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 = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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 target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 JobTargetGroupInner object if successful. + */ + public JobTargetGroupInner get(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toBlocking().single().body(); + } + + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 jobAgentName, String targetGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName), serviceCallback); + } + + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1, JobTargetGroupInner>() { + @Override + public JobTargetGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName 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, jobAgentName, targetGroupName, 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 target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @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 JobTargetGroupInner object if successful. + */ + public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).toBlocking().single().body(); + } + + /** + * Creates or updates a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @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 jobAgentName, String targetGroupName, List members, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members), serviceCallback); + } + + /** + * Creates or updates a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).map(new Func1, JobTargetGroupInner>() { + @Override + public JobTargetGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName 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 (members == null) { + throw new IllegalArgumentException("Parameter members is required and cannot be null."); + } + Validator.validate(members); + JobTargetGroupInner parameters = new JobTargetGroupInner(); + parameters.withMembers(members); + return service.createOrUpdate(resourceGroupName, serverName, jobAgentName, targetGroupName, 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 = 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 a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 jobAgentName, String targetGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toBlocking().single().body(); + } + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 jobAgentName, String targetGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName), serviceCallback); + } + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName 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.delete(resourceGroupName, serverName, jobAgentName, targetGroupName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all target groups in an agent. + * + * @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<JobTargetGroupInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all target groups in an agent. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all target groups in an agent. + * + * @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<JobTargetGroupInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all target groups in an agent. + * + * @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<JobTargetGroupInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all target groups in an agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobTargetGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionImpl.java new file mode 100644 index 0000000000000..13b3148181717 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobVersion; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class JobVersionImpl extends IndexableRefreshableWrapperImpl implements JobVersion { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private int jobVersion; + + JobVersionImpl(JobVersionInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.jobVersion = IdParsingUtils.getValueFromIdByName(inner.id(), "versions"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + JobVersionsInner client = this.manager().inner().jobVersions(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobVersion); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionInner.java new file mode 100644 index 0000000000000..837fbf0bc0606 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionInner.java @@ -0,0 +1,17 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.ProxyResource; + +/** + * A job version. + */ +public class JobVersionInner extends ProxyResource { +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsImpl.java new file mode 100644 index 0000000000000..55262bbe23c35 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobVersions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobVersion; + +class JobVersionsImpl extends WrapperImpl implements JobVersions { + private final SqlManager manager; + + JobVersionsImpl(SqlManager manager) { + super(manager.inner().jobVersions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private JobVersionImpl wrapModel(JobVersionInner inner) { + return new JobVersionImpl(inner, manager()); + } + + @Override + public Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + JobVersionsInner client = this.inner(); + return client.listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobVersion call(JobVersionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + JobVersionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .map(new Func1() { + @Override + public JobVersion call(JobVersionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsInner.java new file mode 100644 index 0000000000000..5f54937af1150 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsInner.java @@ -0,0 +1,428 @@ +/** + * 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.v2017_03_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 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 JobVersions. + */ +public class JobVersionsInner { + /** The Retrofit service to perform REST calls. */ + private JobVersionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobVersionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobVersionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobVersionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobVersions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobVersionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.JobVersions listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v2017_03_01_preview.JobVersions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @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.v2017_03_01_preview.JobVersions listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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<JobVersionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all versions of a job. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobVersionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByJob(resourceGroupName, serverName, jobAgentName, jobName, 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 = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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 job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 JobVersionInner object if successful. + */ + public JobVersionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).toBlocking().single().body(); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 jobAgentName, String jobName, int jobVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), serviceCallback); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobVersionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).map(new Func1, JobVersionInner>() { + @Override + public JobVersionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobVersionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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, jobAgentName, jobName, jobVersion, 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 all versions of a job. + * + * @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<JobVersionInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all versions of a job. + * + * @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> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all versions of a job. + * + * @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<JobVersionInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all versions of a job. + * + * @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<JobVersionInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all versions of a job. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobVersionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(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.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsImpl.java new file mode 100644 index 0000000000000..7be726535b564 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Jobs; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Job; + +class JobsImpl extends WrapperImpl implements Jobs { + private final SqlManager manager; + + JobsImpl(SqlManager manager) { + super(manager.inner().jobs()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobImpl define(String name) { + return wrapModel(name); + } + + private JobImpl wrapModel(JobInner inner) { + return new JobImpl(inner, manager()); + } + + private JobImpl wrapModel(String name) { + return new JobImpl(name, this.manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Job call(JobInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1() { + @Override + public Job call(JobInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, jobName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsInner.java new file mode 100644 index 0000000000000..015363a6c2329 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsInner.java @@ -0,0 +1,637 @@ +/** + * 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.v2017_03_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 Jobs. + */ +public class JobsInner { + /** The Retrofit service to perform REST calls. */ + private JobsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Jobs to be + * used by Retrofit to perform actually REST calls. + */ + interface JobsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.Jobs listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v2017_03_01_preview.Jobs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v2017_03_01_preview.Jobs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("subscriptionId") String subscriptionId, @Body JobInner 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.v2017_03_01_preview.Jobs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v2017_03_01_preview.Jobs listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs. + * + 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, 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 = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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 job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobInner object if successful. + */ + public JobInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobInner>() { + @Override + public JobInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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, jobAgentName, jobName, 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 job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job 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 JobInner object if successful. + */ + public JobInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job 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 serverName, String jobAgentName, String jobName, JobInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters), serviceCallback); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).map(new Func1, JobInner>() { + @Override + public JobInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, 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 a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 jobAgentName, String jobName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.delete(resourceGroupName, serverName, jobAgentName, jobName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of jobs. + * + * @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<JobInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs. + * + * @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<JobInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs. + * + * @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<JobInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java new file mode 100644 index 0000000000000..4207889c4224b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackup; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class LongTermRetentionBackupImpl extends IndexableRefreshableWrapperImpl implements LongTermRetentionBackup { + private final SqlManager manager; + private String locationName; + private String longTermRetentionServerName; + private String longTermRetentionDatabaseName; + private String backupName; + + LongTermRetentionBackupImpl(LongTermRetentionBackupInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.longTermRetentionServerName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionServers"); + this.longTermRetentionDatabaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionDatabases"); + this.backupName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionBackups"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + LongTermRetentionBackupsInner client = this.manager().inner().longTermRetentionBackups(); + return client.getAsync(this.locationName, this.longTermRetentionServerName, this.longTermRetentionDatabaseName, 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 String name() { + return this.inner().name(); + } + + @Override + public DateTime serverCreateTime() { + return this.inner().serverCreateTime(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupInner.java new file mode 100644 index 0000000000000..0c05a5598b8d0 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupInner.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.v2017_03_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. + */ +@JsonFlatten +public class LongTermRetentionBackupInner extends ProxyResource { + /** + * The server name that the backup database belong to. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The create time of the server. + */ + @JsonProperty(value = "properties.serverCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime serverCreateTime; + + /** + * 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 server name that the backup database belong to. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the create time of the server. + * + * @return the serverCreateTime value + */ + public DateTime serverCreateTime() { + return this.serverCreateTime; + } + + /** + * 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java new file mode 100644 index 0000000000000..b005c4aec91bb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java @@ -0,0 +1,108 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackup; + +class LongTermRetentionBackupsImpl extends WrapperImpl implements LongTermRetentionBackups { + private final SqlManager manager; + + LongTermRetentionBackupsImpl(SqlManager manager) { + super(manager.inner().longTermRetentionBackups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private LongTermRetentionBackupImpl wrapModel(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + + @Override + public Observable listByLocationAsync(final String locationName) { + LongTermRetentionBackupsInner 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 LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(final String locationName, final String longTermRetentionServerName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.listByServerAsync(locationName, longTermRetentionServerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.listByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.getAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java new file mode 100644 index 0000000000000..b4318cbee543d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java @@ -0,0 +1,1468 @@ +/** + * 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.v2017_03_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.v2017_03_01_preview.LongTermRetentionDatabaseState; +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 LongTermRetentionBackups. + */ +public class LongTermRetentionBackupsInner { + /** The Retrofit service to perform REST calls. */ + private LongTermRetentionBackupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionBackupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LongTermRetentionBackupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(LongTermRetentionBackupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LongTermRetentionBackups to be + * used by Retrofit to perform actually REST calls. + */ + interface LongTermRetentionBackupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + Observable> get(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @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.v2017_03_01_preview.LongTermRetentionBackups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @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.v2017_03_01_preview.LongTermRetentionBackups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @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.v2017_03_01_preview.LongTermRetentionBackups listByDatabase" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups") + Observable> listByDatabase(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState 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.v2017_03_01_preview.LongTermRetentionBackups listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups") + Observable> listByLocation(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState 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.v2017_03_01_preview.LongTermRetentionBackups listByServer" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups") + Observable> listByServer(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState 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.v2017_03_01_preview.LongTermRetentionBackups 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.v2017_03_01_preview.LongTermRetentionBackups 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.v2017_03_01_preview.LongTermRetentionBackups listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 LongTermRetentionBackupInner object if successful. + */ + public LongTermRetentionBackupInner get(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionBackupInner object + */ + public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, LongTermRetentionBackupInner>() { + @Override + public LongTermRetentionBackupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionBackupInner object + */ + public Observable> getWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().last().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName 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 + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName 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> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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 LongTermRetentionDatabaseState databaseState = null; + return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName the String value + ServiceResponse> * @param longTermRetentionDatabaseName the String value + 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<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 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<LongTermRetentionBackupInner> 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 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 a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> 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 a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> 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 a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> 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 LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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 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 LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName 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 + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName 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> listByServerAsync(final String locationName, final String longTermRetentionServerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName) + .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)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName 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 LongTermRetentionDatabaseState databaseState = null; + return service.listByServer(locationName, longTermRetentionServerName, 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 = listByServerDelegate(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 server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName, 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(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName the String value + 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<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName 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(locationName, longTermRetentionServerName, 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 = 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); + } + + /** + * Lists all long term retention backups for a 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<LongTermRetentionBackupInner> 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 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 the long term retention backups for a given 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<LongTermRetentionBackupInner> 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(); + } + }; + } + + /** + * Lists the long term retention backups for a given 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); + } + + /** + * Lists the long term retention backups for a given 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<LongTermRetentionBackupInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given 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<LongTermRetentionBackupInner> 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)); + } + }); + } + + /** + * Lists the long term retention backups for a given 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<LongTermRetentionBackupInner> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..55d69142e4744 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicy; + +class ManagedBackupShortTermRetentionPoliciesImpl extends WrapperImpl implements ManagedBackupShortTermRetentionPolicies { + private final SqlManager manager; + + ManagedBackupShortTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().managedBackupShortTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedBackupShortTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private ManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, manager()); + } + + private ManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new ManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedBackupShortTermRetentionPoliciesInner 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 ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedBackupShortTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..ca0d048391ff7 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java @@ -0,0 +1,1135 @@ +/** + * 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.v2017_03_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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 ManagedBackupShortTermRetentionPolicies. + */ +public class ManagedBackupShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedBackupShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedBackupShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedBackupShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedBackupShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedBackupShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedBackupShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{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.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies") + 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.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed database's short 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 short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner 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); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 + */ + public Observable> createOrUpdateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 = 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); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 + */ + public Observable> updateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @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 managed database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedBackupShortTermRetentionPolicyInner> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..ecb7c91203b5b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ManagedBackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements ManagedBackupShortTermRetentionPolicy, ManagedBackupShortTermRetentionPolicy.Definition, ManagedBackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + ManagedBackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedBackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ManagedBackupShortTermRetentionPolicyImpl(ManagedBackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + 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 name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedBackupShortTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..a6f62c33be226 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPolicyInner.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.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A short term retention policy. + */ +@JsonFlatten +public class ManagedBackupShortTermRetentionPolicyInner extends ProxyResource { + /** + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @param retentionDays the retentionDays value to set + * @return the ManagedBackupShortTermRetentionPolicyInner object itself. + */ + public ManagedBackupShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java new file mode 100644 index 0000000000000..19696f74c3064 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java @@ -0,0 +1,277 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabase; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseUpdate; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseStatus; +import com.microsoft.azure.management.sql.v2017_03_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2017_03_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(); + // resource ancestor names + 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 name() { + return this.inner().name(); + } + + @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 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java new file mode 100644 index 0000000000000..9f704415711c2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java @@ -0,0 +1,296 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseStatus; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_03_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2017_03_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 for the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible'. + */ + @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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + */ + @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; + + /** + * 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; + + /** + * 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 for the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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 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; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesImpl.java new file mode 100644 index 0000000000000..c4edf7cbb4336 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabases; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabase; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; + +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) + .map(new Func1() { + @Override + public ManagedDatabase call(ManagedDatabaseInner inner) { + return 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 locationName, UUID operationId, String lastBackupName) { + ManagedDatabasesInner client = this.inner(); + return client.completeRestoreAsync(locationName, operationId, lastBackupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java new file mode 100644 index 0000000000000..978f15b2b56c8 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java @@ -0,0 +1,1156 @@ +/** + * 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.v2017_03_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.v2017_03_01_preview.CompleteDatabaseRestoreDefinition; +import com.microsoft.azure.management.sql.v2017_03_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 java.util.UUID; +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.v2017_03_01_preview.ManagedDatabases completeRestore" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore") + Observable> completeRestore(@Path("locationName") String locationName, @Path("operationId") UUID operationId, @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.v2017_03_01_preview.ManagedDatabases beginCompleteRestore" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore") + Observable> beginCompleteRestore(@Path("locationName") String locationName, @Path("operationId") UUID operationId, @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.v2017_03_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.v2017_03_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.v2017_03_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.v2017_03_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.v2017_03_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.v2017_03_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.v2017_03_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.v2017_03_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.v2017_03_01_preview.ManagedDatabases listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().last().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + return completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName 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."); + } + 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(locationName, operationId, 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 locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().single().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + return beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName 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."); + } + if (lastBackupName == null) { + throw new IllegalArgumentException("Parameter lastBackupName is required and cannot be null."); + } + CompleteDatabaseRestoreDefinition parameters = new CompleteDatabaseRestoreDefinition(); + parameters.withLastBackupName(lastBackupName); + return service.beginCompleteRestore(locationName, operationId, 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 resourceGroupName The 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 the 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 the 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 the 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 the 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 the 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 the 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 the 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 the 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); + } + + /** + * 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..6086f2e512539 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl1.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl1.java new file mode 100644 index 0000000000000..ce10faec27fbb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointImpl.java new file mode 100644 index 0000000000000..dc3aaeff0f5fe --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointImpl.java @@ -0,0 +1,86 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoint; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePointType; + +class RestorePointImpl extends IndexableRefreshableWrapperImpl implements RestorePoint { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String restorePointName; + + RestorePointImpl(RestorePointInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.restorePointName = IdParsingUtils.getValueFromIdByName(inner.id(), "restorePoints"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RestorePointsInner client = this.manager().inner().restorePoints(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.restorePointName); + } + + + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime restorePointCreationDate() { + return this.inner().restorePointCreationDate(); + } + + @Override + public String restorePointLabel() { + return this.inner().restorePointLabel(); + } + + @Override + public RestorePointType restorePointType() { + return this.inner().restorePointType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointInner.java new file mode 100644 index 0000000000000..f1d87f9f5d8fe --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointInner.java @@ -0,0 +1,98 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePointType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Database restore points. + */ +@JsonFlatten +public class RestorePointInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The type of restore point. Possible values include: 'CONTINUOUS', + * 'DISCRETE'. + */ + @JsonProperty(value = "properties.restorePointType", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointType restorePointType; + + /** + * The earliest time to which this database can be restored. + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The time the backup was taken. + */ + @JsonProperty(value = "properties.restorePointCreationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime restorePointCreationDate; + + /** + * The label of restore point for backup request by user. + */ + @JsonProperty(value = "properties.restorePointLabel", access = JsonProperty.Access.WRITE_ONLY) + private String restorePointLabel; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the type of restore point. Possible values include: 'CONTINUOUS', 'DISCRETE'. + * + * @return the restorePointType value + */ + public RestorePointType restorePointType() { + return this.restorePointType; + } + + /** + * Get the earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the time the backup was taken. + * + * @return the restorePointCreationDate value + */ + public DateTime restorePointCreationDate() { + return this.restorePointCreationDate; + } + + /** + * Get the label of restore point for backup request by user. + * + * @return the restorePointLabel value + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsImpl.java new file mode 100644 index 0000000000000..25fa4447b3ffb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoints; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoint; + +class RestorePointsImpl extends WrapperImpl implements RestorePoints { + private final SqlManager manager; + + RestorePointsImpl(SqlManager manager) { + super(manager.inner().restorePoints()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RestorePointImpl wrapModel(RestorePointInner inner) { + return new RestorePointImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + RestorePointsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RestorePoint call(RestorePointInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + RestorePointsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, restorePointName) + .map(new Func1() { + @Override + public RestorePoint call(RestorePointInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + RestorePointsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, restorePointName).toCompletable(); + } + + @Override + public Observable createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + RestorePointsInner client = this.inner(); + return client.createAsync(resourceGroupName, serverName, databaseName, restorePointLabel) + .map(new Func1() { + @Override + public RestorePoint call(RestorePointInner inner) { + return new RestorePointImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsInner.java new file mode 100644 index 0000000000000..3240fa8167c2b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorePointsInner.java @@ -0,0 +1,567 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2017_03_01_preview.CreateDatabaseRestorePointDefinition; +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.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.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RestorePoints. + */ +public class RestorePointsInner { + /** The Retrofit service to perform REST calls. */ + private RestorePointsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorePointsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RestorePointsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RestorePointsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RestorePoints to be + * used by Retrofit to perform actually REST calls. + */ + interface RestorePointsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoints listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") + 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.v2017_03_01_preview.RestorePoints create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") + Observable> create(@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, @Body CreateDatabaseRestorePointDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoints beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") + Observable> beginCreate(@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, @Body CreateDatabaseRestorePointDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoints get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("restorePointName") String restorePointName, @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.v2017_03_01_preview.RestorePoints delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("restorePointName") String restorePointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @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 List<RestorePointInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RestorePointInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RestorePointInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 + * @return the RestorePointInner object if successful. + */ + public RestorePointInner create(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).toBlocking().last().body(); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel), serviceCallback); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).map(new Func1, RestorePointInner>() { + @Override + public RestorePointInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + 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."); + } + if (restorePointLabel == null) { + throw new IllegalArgumentException("Parameter restorePointLabel is required and cannot be null."); + } + CreateDatabaseRestorePointDefinition parameters = new CreateDatabaseRestorePointDefinition(); + parameters.withRestorePointLabel(restorePointLabel); + Observable> observable = service.create(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 + * @return the RestorePointInner object if successful. + */ + public RestorePointInner beginCreate(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).toBlocking().single().body(); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 beginCreateAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel), serviceCallback); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).map(new Func1, RestorePointInner>() { + @Override + public RestorePointInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + 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."); + } + if (restorePointLabel == null) { + throw new IllegalArgumentException("Parameter restorePointLabel is required and cannot be null."); + } + CreateDatabaseRestorePointDefinition parameters = new CreateDatabaseRestorePointDefinition(); + parameters.withRestorePointLabel(restorePointLabel); + return service.beginCreate(resourceGroupName, serverName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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 RestorePointInner object if successful. + */ + public RestorePointInner get(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).toBlocking().single().body(); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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, String restorePointName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName), serviceCallback); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).map(new Func1, RestorePointInner>() { + @Override + public RestorePointInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + 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 (restorePointName == null) { + throw new IllegalArgumentException("Parameter restorePointName 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, databaseName, restorePointName, 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 restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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 databaseName, String restorePointName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).toBlocking().single().body(); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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 databaseName, String restorePointName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName), serviceCallback); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + 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 (restorePointName == null) { + throw new IllegalArgumentException("Parameter restorePointName 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.delete(resourceGroupName, serverName, databaseName, restorePointName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningImpl.java new file mode 100644 index 0000000000000..5d5a9e267e7f9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningImpl.java @@ -0,0 +1,59 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTuning; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.AutomaticTuningServerMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_03_01_preview.AutomaticTuningServerOptions; + +class ServerAutomaticTuningImpl extends WrapperImpl implements ServerAutomaticTuning { + private final SqlManager manager; + ServerAutomaticTuningImpl(ServerAutomaticTuningInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public AutomaticTuningServerMode actualState() { + return this.inner().actualState(); + } + + @Override + public AutomaticTuningServerMode desiredState() { + return this.inner().desiredState(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map options() { + return this.inner().options(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningInner.java new file mode 100644 index 0000000000000..335266744461e --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningInner.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.AutomaticTuningServerMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_03_01_preview.AutomaticTuningServerOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Server-level Automatic Tuning. + */ +@JsonFlatten +public class ServerAutomaticTuningInner extends ProxyResource { + /** + * Automatic tuning desired state. Possible values include: 'Custom', + * 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.desiredState") + private AutomaticTuningServerMode desiredState; + + /** + * Automatic tuning actual state. Possible values include: 'Custom', + * 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerMode actualState; + + /** + * Automatic tuning options definition. + */ + @JsonProperty(value = "properties.options") + private Map options; + + /** + * Get automatic tuning desired state. Possible values include: 'Custom', 'Auto', 'Unspecified'. + * + * @return the desiredState value + */ + public AutomaticTuningServerMode desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning desired state. Possible values include: 'Custom', 'Auto', 'Unspecified'. + * + * @param desiredState the desiredState value to set + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withDesiredState(AutomaticTuningServerMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning actual state. Possible values include: 'Custom', 'Auto', 'Unspecified'. + * + * @return the actualState value + */ + public AutomaticTuningServerMode actualState() { + return this.actualState; + } + + /** + * Get automatic tuning options definition. + * + * @return the options value + */ + public Map options() { + return this.options; + } + + /** + * Set automatic tuning options definition. + * + * @param options the options value to set + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withOptions(Map options) { + this.options = options; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..1b1ff8a6fb722 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTunings; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTuning; + +class ServerAutomaticTuningsImpl extends WrapperImpl implements ServerAutomaticTunings { + private final SqlManager manager; + + ServerAutomaticTuningsImpl(SqlManager manager) { + super(manager.inner().serverAutomaticTunings()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerAutomaticTuningsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerAutomaticTuning call(ServerAutomaticTuningInner inner) { + return new ServerAutomaticTuningImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + ServerAutomaticTuningsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serverName, parameters) + .map(new Func1() { + @Override + public ServerAutomaticTuning call(ServerAutomaticTuningInner inner) { + return new ServerAutomaticTuningImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsInner.java new file mode 100644 index 0000000000000..c7912cd631e7b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsInner.java @@ -0,0 +1,247 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 ServerAutomaticTunings. + */ +public class ServerAutomaticTuningsInner { + /** The Retrofit service to perform REST calls. */ + private ServerAutomaticTuningsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAutomaticTuningsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerAutomaticTuningsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerAutomaticTuningsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerAutomaticTunings to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerAutomaticTuningsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTunings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current") + Observable> get(@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.v2017_03_01_preview.ServerAutomaticTunings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerAutomaticTuningInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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 ServerAutomaticTuningInner object if successful. + */ + public ServerAutomaticTuningInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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 ServerAutomaticTuningInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerAutomaticTuningInner>() { + @Override + public ServerAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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 ServerAutomaticTuningInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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.get(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 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); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning 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 ServerAutomaticTuningInner object if successful. + */ + public ServerAutomaticTuningInner update(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning 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 serverName, ServerAutomaticTuningInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAutomaticTuningInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerAutomaticTuningInner>() { + @Override + public ServerAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAutomaticTuningInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner 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 (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.update(resourceGroupName, serverName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..d964879c7d942 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerBlobAuditingPolicy; + +class ServerBlobAuditingPoliciesImpl extends WrapperImpl implements ServerBlobAuditingPolicies { + private final SqlManager manager; + + ServerBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().serverBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private ServerBlobAuditingPolicyImpl wrapModel(ServerBlobAuditingPolicyInner inner) { + return new ServerBlobAuditingPolicyImpl(inner, manager()); + } + + private ServerBlobAuditingPolicyImpl wrapModel(String name) { + return new ServerBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerBlobAuditingPolicy call(ServerBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..34a390ea8d445 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerBlobAuditingPolicies. + */ +public class ServerBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ServerBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ServerBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v2017_03_01_preview.ServerBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerBlobAuditingPolicyInner 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.v2017_03_01_preview.ServerBlobAuditingPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a server's blob auditing 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. + * @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 ServerBlobAuditingPolicyInner object if successful. + */ + public ServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a server's blob auditing 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 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's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerBlobAuditingPolicyInner>() { + @Override + public ServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, blobAuditingPolicyName, 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 server's blob auditing 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 parameters Properties of blob auditing 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 ServerBlobAuditingPolicyInner object if successful. + */ + public ServerBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing 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, ServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerBlobAuditingPolicyInner>() { + @Override + public ServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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 server's blob auditing 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 parameters Properties of blob auditing 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 ServerBlobAuditingPolicyInner object if successful. + */ + public ServerBlobAuditingPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerBlobAuditingPolicyInner>() { + @Override + public ServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..4807b4d5cf1c4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyImpl.java @@ -0,0 +1,183 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class ServerBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements ServerBlobAuditingPolicy, ServerBlobAuditingPolicy.Definition, ServerBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new ServerBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerBlobAuditingPolicyImpl(ServerBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerBlobAuditingPoliciesInner client = this.manager().inner().serverBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerBlobAuditingPoliciesInner client = this.manager().inner().serverBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerBlobAuditingPoliciesInner client = this.manager().inner().serverBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..f8e45d42ec641 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyInner.java @@ -0,0 +1,428 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server blob auditing policy. + */ +@JsonFlatten +public class ServerBlobAuditingPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasImpl.java new file mode 100644 index 0000000000000..d856de42db0f4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasImpl.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. + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAlias; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ServerDnsAliasImpl extends CreatableUpdatableImpl implements ServerDnsAlias, ServerDnsAlias.Definition, ServerDnsAlias.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String dnsAliasName; + + ServerDnsAliasImpl(String name, SqlManager manager) { + super(name, new ServerDnsAliasInner()); + this.manager = manager; + // Set resource name + this.dnsAliasName = name; + // + } + + ServerDnsAliasImpl(ServerDnsAliasInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dnsAliasName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.dnsAliasName = IdParsingUtils.getValueFromIdByName(inner.id(), "dnsAliases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerDnsAliasesInner client = this.manager().inner().serverDnsAliases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.dnsAliasName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerDnsAliasesInner client = this.manager().inner().serverDnsAliases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.dnsAliasName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerDnsAliasesInner client = this.manager().inner().serverDnsAliases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.dnsAliasName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String azureDnsRecord() { + return this.inner().azureDnsRecord(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerDnsAliasImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasInner.java new file mode 100644 index 0000000000000..144c4529b9696 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasInner.java @@ -0,0 +1,35 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server DNS alias. + */ +@JsonFlatten +public class ServerDnsAliasInner extends ProxyResource { + /** + * The fully qualified DNS record for alias. + */ + @JsonProperty(value = "properties.azureDnsRecord", access = JsonProperty.Access.WRITE_ONLY) + private String azureDnsRecord; + + /** + * Get the fully qualified DNS record for alias. + * + * @return the azureDnsRecord value + */ + public String azureDnsRecord() { + return this.azureDnsRecord; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesImpl.java new file mode 100644 index 0000000000000..1cee5275d29b0 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesImpl.java @@ -0,0 +1,87 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAlias; + +class ServerDnsAliasesImpl extends WrapperImpl implements ServerDnsAliases { + private final SqlManager manager; + + ServerDnsAliasesImpl(SqlManager manager) { + super(manager.inner().serverDnsAliases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerDnsAliasImpl define(String name) { + return wrapModel(name); + } + + private ServerDnsAliasImpl wrapModel(ServerDnsAliasInner inner) { + return new ServerDnsAliasImpl(inner, manager()); + } + + private ServerDnsAliasImpl wrapModel(String name) { + return new ServerDnsAliasImpl(name, this.manager()); + } + + @Override + public Completable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasesInner client = this.inner(); + return client.acquireAsync(resourceGroupName, serverName, dnsAliasName).toCompletable(); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerDnsAliasesInner 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 ServerDnsAlias call(ServerDnsAliasInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, dnsAliasName) + .map(new Func1() { + @Override + public ServerDnsAlias call(ServerDnsAliasInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, dnsAliasName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java new file mode 100644 index 0000000000000..0ec5b30bfa10d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java @@ -0,0 +1,1115 @@ +/** + * 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.v2017_03_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.v2017_03_01_preview.ServerDnsAliasAcquisition; +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.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 ServerDnsAliases. + */ +public class ServerDnsAliasesInner { + /** The Retrofit service to perform REST calls. */ + private ServerDnsAliasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerDnsAliasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerDnsAliasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerDnsAliasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerDnsAliases to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerDnsAliasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v2017_03_01_preview.ServerDnsAliases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v2017_03_01_preview.ServerDnsAliases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v2017_03_01_preview.ServerDnsAliases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v2017_03_01_preview.ServerDnsAliases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v2017_03_01_preview.ServerDnsAliases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases") + 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.v2017_03_01_preview.ServerDnsAliases acquire" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire") + Observable> acquire(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerDnsAliasAcquisition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases beginAcquire" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire") + Observable> beginAcquire(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerDnsAliasAcquisition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 ServerDnsAliasInner object if successful. + */ + public ServerDnsAliasInner get(String resourceGroupName, String serverName, String dnsAliasName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, ServerDnsAliasInner>() { + @Override + public ServerDnsAliasInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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, dnsAliasName, 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 server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 ServerDnsAliasInner object if successful. + */ + public ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, ServerDnsAliasInner>() { + @Override + public ServerDnsAliasInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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.createOrUpdate(resourceGroupName, serverName, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 ServerDnsAliasInner object if successful. + */ + public ServerDnsAliasInner beginCreateOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, ServerDnsAliasInner>() { + @Override + public ServerDnsAliasInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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.beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, 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 = 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 the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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, dnsAliasName, 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 a list of server DNS aliases for 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 that the alias is pointing to. + * @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<ServerDnsAliasInner> 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 DNS aliases for 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 that the alias is pointing to. + * @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 DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerDnsAliasInner> 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 DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerDnsAliasInner> 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 DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerDnsAliasInner> 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); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 acquire(String resourceGroupName, String serverName, String dnsAliasName) { + acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> acquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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 oldServerDnsAliasId = null; + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(null); + Observable> observable = service.acquire(resourceGroupName, serverName, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 acquire(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).toBlocking().last().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + return acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> acquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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."); + } + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(oldServerDnsAliasId); + Observable> observable = service.acquire(resourceGroupName, serverName, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 beginAcquire(String resourceGroupName, String serverName, String dnsAliasName) { + beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginAcquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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 oldServerDnsAliasId = null; + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(null); + return service.beginAcquire(resourceGroupName, serverName, dnsAliasName, 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 = beginAcquireDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 beginAcquire(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).toBlocking().single().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + return beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginAcquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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."); + } + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(oldServerDnsAliasId); + return service.beginAcquire(resourceGroupName, serverName, dnsAliasName, 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 = beginAcquireDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginAcquireDelegate(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 server DNS aliases for 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<ServerDnsAliasInner> 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 DNS aliases for 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 a list of server DNS aliases for 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<ServerDnsAliasInner> 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 DNS aliases for 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<ServerDnsAliasInner> 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 DNS aliases for 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<ServerDnsAliasInner> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..c6ade364ecd0d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicy; + +class ServerSecurityAlertPoliciesImpl extends WrapperImpl implements ServerSecurityAlertPolicies { + private final SqlManager manager; + + ServerSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().serverSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerSecurityAlertPolicyImpl define(String name) { + return wrapModel(name); + } + + private ServerSecurityAlertPolicyImpl wrapModel(ServerSecurityAlertPolicyInner inner) { + return new ServerSecurityAlertPolicyImpl(inner, manager()); + } + + private ServerSecurityAlertPolicyImpl wrapModel(String name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerSecurityAlertPolicy call(ServerSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java new file mode 100644 index 0000000000000..def77e2a49bb1 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerSecurityAlertPolicies. + */ +public class ServerSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ServerSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v2017_03_01_preview.ServerSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerSecurityAlertPolicyInner 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.v2017_03_01_preview.ServerSecurityAlertPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get a server'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. + * @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 ServerSecurityAlertPolicyInner object if successful. + */ + public ServerSecurityAlertPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Get a server'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 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); + } + + /** + * Get a server'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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerSecurityAlertPolicyInner>() { + @Override + public ServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a server'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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String securityAlertPolicyName = "Default"; + return service.get(resourceGroupName, serverName, 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 threat detection 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 parameters The server 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 ServerSecurityAlertPolicyInner object if successful. + */ + public ServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The server 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, ServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerSecurityAlertPolicyInner>() { + @Override + public ServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner 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 (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"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, 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 threat detection 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 parameters The server 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 ServerSecurityAlertPolicyInner object if successful. + */ + public ServerSecurityAlertPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The server 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerSecurityAlertPolicyInner>() { + @Override + public ServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner 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 (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.beginCreateOrUpdate(resourceGroupName, serverName, 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 = 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..ffda6000b3e85 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java @@ -0,0 +1,171 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; + +class ServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ServerSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerSecurityAlertPolicyImpl(ServerSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerSecurityAlertPoliciesInner client = this.manager().inner().serverSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerSecurityAlertPoliciesInner client = this.manager().inner().serverSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerSecurityAlertPoliciesInner client = this.manager().inner().serverSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @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 ServerSecurityAlertPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..2441ffcb32c1c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java @@ -0,0 +1,210 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server security alert policy. + */ +@JsonFlatten +public class ServerSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled. + * 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; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled. 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. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..8805ab4bf344d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java @@ -0,0 +1,546 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ExtendedDatabaseBlobAuditingPoliciesInner object to access its operations. + */ + private ExtendedDatabaseBlobAuditingPoliciesInner extendedDatabaseBlobAuditingPolicies; + + /** + * Gets the ExtendedDatabaseBlobAuditingPoliciesInner object to access its operations. + * @return the ExtendedDatabaseBlobAuditingPoliciesInner object. + */ + public ExtendedDatabaseBlobAuditingPoliciesInner extendedDatabaseBlobAuditingPolicies() { + return this.extendedDatabaseBlobAuditingPolicies; + } + + /** + * The ExtendedServerBlobAuditingPoliciesInner object to access its operations. + */ + private ExtendedServerBlobAuditingPoliciesInner extendedServerBlobAuditingPolicies; + + /** + * Gets the ExtendedServerBlobAuditingPoliciesInner object to access its operations. + * @return the ExtendedServerBlobAuditingPoliciesInner object. + */ + public ExtendedServerBlobAuditingPoliciesInner extendedServerBlobAuditingPolicies() { + return this.extendedServerBlobAuditingPolicies; + } + + /** + * The ServerBlobAuditingPoliciesInner object to access its operations. + */ + private ServerBlobAuditingPoliciesInner serverBlobAuditingPolicies; + + /** + * Gets the ServerBlobAuditingPoliciesInner object to access its operations. + * @return the ServerBlobAuditingPoliciesInner object. + */ + public ServerBlobAuditingPoliciesInner serverBlobAuditingPolicies() { + return this.serverBlobAuditingPolicies; + } + + /** + * The DatabaseBlobAuditingPoliciesInner object to access its operations. + */ + private DatabaseBlobAuditingPoliciesInner databaseBlobAuditingPolicies; + + /** + * Gets the DatabaseBlobAuditingPoliciesInner object to access its operations. + * @return the DatabaseBlobAuditingPoliciesInner object. + */ + public DatabaseBlobAuditingPoliciesInner databaseBlobAuditingPolicies() { + return this.databaseBlobAuditingPolicies; + } + + /** + * The DatabaseOperationsInner object to access its operations. + */ + private DatabaseOperationsInner databaseOperations; + + /** + * Gets the DatabaseOperationsInner object to access its operations. + * @return the DatabaseOperationsInner object. + */ + public DatabaseOperationsInner databaseOperations() { + return this.databaseOperations; + } + + /** + * 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 DatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentRuleBaselinesInner databaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the DatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentRuleBaselinesInner object. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesInner databaseVulnerabilityAssessmentRuleBaselines() { + return this.databaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * The DatabaseVulnerabilityAssessmentsInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentsInner databaseVulnerabilityAssessments; + + /** + * Gets the DatabaseVulnerabilityAssessmentsInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentsInner object. + */ + public DatabaseVulnerabilityAssessmentsInner databaseVulnerabilityAssessments() { + return this.databaseVulnerabilityAssessments; + } + + /** + * The DataWarehouseUserActivitiesInner object to access its operations. + */ + private DataWarehouseUserActivitiesInner dataWarehouseUserActivities; + + /** + * Gets the DataWarehouseUserActivitiesInner object to access its operations. + * @return the DataWarehouseUserActivitiesInner object. + */ + public DataWarehouseUserActivitiesInner dataWarehouseUserActivities() { + return this.dataWarehouseUserActivities; + } + + /** + * The JobAgentsInner object to access its operations. + */ + private JobAgentsInner jobAgents; + + /** + * Gets the JobAgentsInner object to access its operations. + * @return the JobAgentsInner object. + */ + public JobAgentsInner jobAgents() { + return this.jobAgents; + } + + /** + * The JobCredentialsInner object to access its operations. + */ + private JobCredentialsInner jobCredentials; + + /** + * Gets the JobCredentialsInner object to access its operations. + * @return the JobCredentialsInner object. + */ + public JobCredentialsInner jobCredentials() { + return this.jobCredentials; + } + + /** + * The JobExecutionsInner object to access its operations. + */ + private JobExecutionsInner jobExecutions; + + /** + * Gets the JobExecutionsInner object to access its operations. + * @return the JobExecutionsInner object. + */ + public JobExecutionsInner jobExecutions() { + return this.jobExecutions; + } + + /** + * The JobsInner object to access its operations. + */ + private JobsInner jobs; + + /** + * Gets the JobsInner object to access its operations. + * @return the JobsInner object. + */ + public JobsInner jobs() { + return this.jobs; + } + + /** + * The JobStepExecutionsInner object to access its operations. + */ + private JobStepExecutionsInner jobStepExecutions; + + /** + * Gets the JobStepExecutionsInner object to access its operations. + * @return the JobStepExecutionsInner object. + */ + public JobStepExecutionsInner jobStepExecutions() { + return this.jobStepExecutions; + } + + /** + * The JobStepsInner object to access its operations. + */ + private JobStepsInner jobSteps; + + /** + * Gets the JobStepsInner object to access its operations. + * @return the JobStepsInner object. + */ + public JobStepsInner jobSteps() { + return this.jobSteps; + } + + /** + * The JobTargetExecutionsInner object to access its operations. + */ + private JobTargetExecutionsInner jobTargetExecutions; + + /** + * Gets the JobTargetExecutionsInner object to access its operations. + * @return the JobTargetExecutionsInner object. + */ + public JobTargetExecutionsInner jobTargetExecutions() { + return this.jobTargetExecutions; + } + + /** + * The JobTargetGroupsInner object to access its operations. + */ + private JobTargetGroupsInner jobTargetGroups; + + /** + * Gets the JobTargetGroupsInner object to access its operations. + * @return the JobTargetGroupsInner object. + */ + public JobTargetGroupsInner jobTargetGroups() { + return this.jobTargetGroups; + } + + /** + * The JobVersionsInner object to access its operations. + */ + private JobVersionsInner jobVersions; + + /** + * Gets the JobVersionsInner object to access its operations. + * @return the JobVersionsInner object. + */ + public JobVersionsInner jobVersions() { + return this.jobVersions; + } + + /** + * The LongTermRetentionBackupsInner object to access its operations. + */ + private LongTermRetentionBackupsInner longTermRetentionBackups; + + /** + * Gets the LongTermRetentionBackupsInner object to access its operations. + * @return the LongTermRetentionBackupsInner object. + */ + public LongTermRetentionBackupsInner longTermRetentionBackups() { + return this.longTermRetentionBackups; + } + + /** + * The BackupLongTermRetentionPoliciesInner object to access its operations. + */ + private BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies; + + /** + * Gets the BackupLongTermRetentionPoliciesInner object to access its operations. + * @return the BackupLongTermRetentionPoliciesInner object. + */ + public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { + return this.backupLongTermRetentionPolicies; + } + + /** + * The ManagedBackupShortTermRetentionPoliciesInner object to access its operations. + */ + private ManagedBackupShortTermRetentionPoliciesInner managedBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedBackupShortTermRetentionPoliciesInner object to access its operations. + * @return the ManagedBackupShortTermRetentionPoliciesInner object. + */ + public ManagedBackupShortTermRetentionPoliciesInner managedBackupShortTermRetentionPolicies() { + return this.managedBackupShortTermRetentionPolicies; + } + + /** + * 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 RestorePointsInner object to access its operations. + */ + private RestorePointsInner restorePoints; + + /** + * Gets the RestorePointsInner object to access its operations. + * @return the RestorePointsInner object. + */ + public RestorePointsInner restorePoints() { + return this.restorePoints; + } + + /** + * The ServerAutomaticTuningsInner object to access its operations. + */ + private ServerAutomaticTuningsInner serverAutomaticTunings; + + /** + * Gets the ServerAutomaticTuningsInner object to access its operations. + * @return the ServerAutomaticTuningsInner object. + */ + public ServerAutomaticTuningsInner serverAutomaticTunings() { + return this.serverAutomaticTunings; + } + + /** + * The ServerDnsAliasesInner object to access its operations. + */ + private ServerDnsAliasesInner serverDnsAliases; + + /** + * Gets the ServerDnsAliasesInner object to access its operations. + * @return the ServerDnsAliasesInner object. + */ + public ServerDnsAliasesInner serverDnsAliases() { + return this.serverDnsAliases; + } + + /** + * The ServerSecurityAlertPoliciesInner object to access its operations. + */ + private ServerSecurityAlertPoliciesInner serverSecurityAlertPolicies; + + /** + * Gets the ServerSecurityAlertPoliciesInner object to access its operations. + * @return the ServerSecurityAlertPoliciesInner object. + */ + public ServerSecurityAlertPoliciesInner serverSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-03-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.extendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.extendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.serverBlobAuditingPolicies = new ServerBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.dataWarehouseUserActivities = new DataWarehouseUserActivitiesInner(restClient().retrofit(), this); + this.jobAgents = new JobAgentsInner(restClient().retrofit(), this); + this.jobCredentials = new JobCredentialsInner(restClient().retrofit(), this); + this.jobExecutions = new JobExecutionsInner(restClient().retrofit(), this); + this.jobs = new JobsInner(restClient().retrofit(), this); + this.jobStepExecutions = new JobStepExecutionsInner(restClient().retrofit(), this); + this.jobSteps = new JobStepsInner(restClient().retrofit(), this); + this.jobTargetExecutions = new JobTargetExecutionsInner(restClient().retrofit(), this); + this.jobTargetGroups = new JobTargetGroupsInner(restClient().retrofit(), this); + this.jobVersions = new JobVersionsInner(restClient().retrofit(), this); + this.longTermRetentionBackups = new LongTermRetentionBackupsInner(restClient().retrofit(), this); + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); + this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); + this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); + this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); + this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); + this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2017-03-01-preview"); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java new file mode 100644 index 0000000000000..17ec28e13069e --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java @@ -0,0 +1,399 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedServerBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseOperations; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Databases; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselines; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DataWarehouseUserActivities; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobAgents; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobCredentials; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobExecutions; +import com.microsoft.azure.management.sql.v2017_03_01_preview.Jobs; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobStepExecutions; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobSteps; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetExecutions; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobTargetGroups; +import com.microsoft.azure.management.sql.v2017_03_01_preview.JobVersions; +import com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups; +import com.microsoft.azure.management.sql.v2017_03_01_preview.BackupLongTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabases; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoints; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTunings; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies; + private ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies; + private ServerBlobAuditingPolicies serverBlobAuditingPolicies; + private DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies; + private DatabaseOperations databaseOperations; + private Databases databases; + private DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines; + private DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments; + private DataWarehouseUserActivities dataWarehouseUserActivities; + private JobAgents jobAgents; + private JobCredentials jobCredentials; + private JobExecutions jobExecutions; + private Jobs jobs; + private JobStepExecutions jobStepExecutions; + private JobSteps jobSteps; + private JobTargetExecutions jobTargetExecutions; + private JobTargetGroups jobTargetGroups; + private JobVersions jobVersions; + private LongTermRetentionBackups longTermRetentionBackups; + private BackupLongTermRetentionPolicies backupLongTermRetentionPolicies; + private ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies; + private ManagedDatabases managedDatabases; + private RestorePoints restorePoints; + private ServerAutomaticTunings serverAutomaticTunings; + private ServerDnsAliases serverDnsAliases; + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ExtendedDatabaseBlobAuditingPolicies. + */ + public ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies() { + if (this.extendedDatabaseBlobAuditingPolicies == null) { + this.extendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesImpl(this); + } + return this.extendedDatabaseBlobAuditingPolicies; + } + + /** + * @return Entry point to manage ExtendedServerBlobAuditingPolicies. + */ + public ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies() { + if (this.extendedServerBlobAuditingPolicies == null) { + this.extendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesImpl(this); + } + return this.extendedServerBlobAuditingPolicies; + } + + /** + * @return Entry point to manage ServerBlobAuditingPolicies. + */ + public ServerBlobAuditingPolicies serverBlobAuditingPolicies() { + if (this.serverBlobAuditingPolicies == null) { + this.serverBlobAuditingPolicies = new ServerBlobAuditingPoliciesImpl(this); + } + return this.serverBlobAuditingPolicies; + } + + /** + * @return Entry point to manage DatabaseBlobAuditingPolicies. + */ + public DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies() { + if (this.databaseBlobAuditingPolicies == null) { + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesImpl(this); + } + return this.databaseBlobAuditingPolicies; + } + + /** + * @return Entry point to manage DatabaseOperations. + */ + public DatabaseOperations databaseOperations() { + if (this.databaseOperations == null) { + this.databaseOperations = new DatabaseOperationsImpl(this); + } + return this.databaseOperations; + } + + /** + * @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 DatabaseVulnerabilityAssessmentRuleBaselines. + */ + public DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines() { + if (this.databaseVulnerabilityAssessmentRuleBaselines == null) { + this.databaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesImpl(this); + } + return this.databaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * @return Entry point to manage DatabaseVulnerabilityAssessments. + */ + public DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments() { + if (this.databaseVulnerabilityAssessments == null) { + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsImpl(this); + } + return this.databaseVulnerabilityAssessments; + } + + /** + * @return Entry point to manage DataWarehouseUserActivities. + */ + public DataWarehouseUserActivities dataWarehouseUserActivities() { + if (this.dataWarehouseUserActivities == null) { + this.dataWarehouseUserActivities = new DataWarehouseUserActivitiesImpl(this); + } + return this.dataWarehouseUserActivities; + } + + /** + * @return Entry point to manage JobAgents. + */ + public JobAgents jobAgents() { + if (this.jobAgents == null) { + this.jobAgents = new JobAgentsImpl(this); + } + return this.jobAgents; + } + + /** + * @return Entry point to manage JobCredentials. + */ + public JobCredentials jobCredentials() { + if (this.jobCredentials == null) { + this.jobCredentials = new JobCredentialsImpl(this); + } + return this.jobCredentials; + } + + /** + * @return Entry point to manage JobExecutions. + */ + public JobExecutions jobExecutions() { + if (this.jobExecutions == null) { + this.jobExecutions = new JobExecutionsImpl(this); + } + return this.jobExecutions; + } + + /** + * @return Entry point to manage Jobs. + */ + public Jobs jobs() { + if (this.jobs == null) { + this.jobs = new JobsImpl(this); + } + return this.jobs; + } + + /** + * @return Entry point to manage JobStepExecutions. + */ + public JobStepExecutions jobStepExecutions() { + if (this.jobStepExecutions == null) { + this.jobStepExecutions = new JobStepExecutionsImpl(this); + } + return this.jobStepExecutions; + } + + /** + * @return Entry point to manage JobSteps. + */ + public JobSteps jobSteps() { + if (this.jobSteps == null) { + this.jobSteps = new JobStepsImpl(this); + } + return this.jobSteps; + } + + /** + * @return Entry point to manage JobTargetExecutions. + */ + public JobTargetExecutions jobTargetExecutions() { + if (this.jobTargetExecutions == null) { + this.jobTargetExecutions = new JobTargetExecutionsImpl(this); + } + return this.jobTargetExecutions; + } + + /** + * @return Entry point to manage JobTargetGroups. + */ + public JobTargetGroups jobTargetGroups() { + if (this.jobTargetGroups == null) { + this.jobTargetGroups = new JobTargetGroupsImpl(this); + } + return this.jobTargetGroups; + } + + /** + * @return Entry point to manage JobVersions. + */ + public JobVersions jobVersions() { + if (this.jobVersions == null) { + this.jobVersions = new JobVersionsImpl(this); + } + return this.jobVersions; + } + + /** + * @return Entry point to manage LongTermRetentionBackups. + */ + public LongTermRetentionBackups longTermRetentionBackups() { + if (this.longTermRetentionBackups == null) { + this.longTermRetentionBackups = new LongTermRetentionBackupsImpl(this); + } + return this.longTermRetentionBackups; + } + + /** + * @return Entry point to manage BackupLongTermRetentionPolicies. + */ + public BackupLongTermRetentionPolicies backupLongTermRetentionPolicies() { + if (this.backupLongTermRetentionPolicies == null) { + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesImpl(this); + } + return this.backupLongTermRetentionPolicies; + } + + /** + * @return Entry point to manage ManagedBackupShortTermRetentionPolicies. + */ + public ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies() { + if (this.managedBackupShortTermRetentionPolicies == null) { + this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesImpl(this); + } + return this.managedBackupShortTermRetentionPolicies; + } + + /** + * @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 RestorePoints. + */ + public RestorePoints restorePoints() { + if (this.restorePoints == null) { + this.restorePoints = new RestorePointsImpl(this); + } + return this.restorePoints; + } + + /** + * @return Entry point to manage ServerAutomaticTunings. + */ + public ServerAutomaticTunings serverAutomaticTunings() { + if (this.serverAutomaticTunings == null) { + this.serverAutomaticTunings = new ServerAutomaticTuningsImpl(this); + } + return this.serverAutomaticTunings; + } + + /** + * @return Entry point to manage ServerDnsAliases. + */ + public ServerDnsAliases serverDnsAliases() { + if (this.serverDnsAliases == null) { + this.serverDnsAliases = new ServerDnsAliasesImpl(this); + } + return this.serverDnsAliases; + } + + /** + * @return Entry point to manage ServerSecurityAlertPolicies. + */ + public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { + if (this.serverSecurityAlertPolicies == null) { + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesImpl(this); + } + return this.serverSecurityAlertPolicies; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/package-info.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..e34819d639e45 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/package-info.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/package-info.java new file mode 100644 index 0000000000000..d0ad1a07b18f9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2017_03_01_preview; diff --git a/sql/resource-manager/v2018_06_01_preview/pom.xml b/sql/resource-manager/v2018_06_01_preview/pom.xml new file mode 100644 index 0000000000000..6d3c32b2e4fea --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v2018_06_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java new file mode 100644 index 0000000000000..7a388ebfe3c99 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessment.java @@ -0,0 +1,175 @@ +/** + * 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.ManagedInstanceVulnerabilityAssessmentInner; +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 ManagedInstanceVulnerabilityAssessment. + */ +public interface ManagedInstanceVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedInstanceVulnerabilityAssessment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstanceVulnerabilityAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstanceVulnerabilityAssessment definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + */ + WithStorageContainerPath withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a ManagedInstanceVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerSasKey { + } + + /** + * Grouping of ManagedInstanceVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstancevulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the managedinstancevulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedinstancevulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessments.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessments.java new file mode 100644 index 0000000000000..7cfcd23fae2f8 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ManagedInstanceVulnerabilityAssessments.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.ManagedInstanceVulnerabilityAssessment; +import rx.Completable; + +/** + * Type representing ManagedInstanceVulnerabilityAssessments. + */ +public interface ManagedInstanceVulnerabilityAssessments { + /** + * Begins definition for a new VulnerabilityAssessment resource. + * @param name resource name. + * @return the first stage of the new VulnerabilityAssessment definition. + */ + ManagedInstanceVulnerabilityAssessment.DefinitionStages.Blank defineVulnerabilityAssessment(String name); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName); + + /** + * Gets the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName); + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java new file mode 100644 index 0000000000000..034e6aaf07578 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessment.java @@ -0,0 +1,175 @@ +/** + * 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.ServerVulnerabilityAssessmentInner; +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 ServerVulnerabilityAssessment. + */ +public interface ServerVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerVulnerabilityAssessment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerVulnerabilityAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerVulnerabilityAssessment definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithStorageContainerPath withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a ServerVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerSasKey { + } + + /** + * Grouping of ServerVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the servervulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the servervulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the servervulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessments.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessments.java new file mode 100644 index 0000000000000..b2b2271a7423b --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/ServerVulnerabilityAssessments.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.ServerVulnerabilityAssessment; +import rx.Completable; + +/** + * Type representing ServerVulnerabilityAssessments. + */ +public interface ServerVulnerabilityAssessments { + /** + * Begins definition for a new VulnerabilityAssessment resource. + * @param name resource name. + * @return the first stage of the new VulnerabilityAssessment definition. + */ + ServerVulnerabilityAssessment.DefinitionStages.Blank defineVulnerabilityAssessment(String name); + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + + /** + * Lists the vulnerability assessment policies associated with 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); + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/VulnerabilityAssessmentRecurringScansProperties.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..470ea7ca70166 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,98 @@ +/** + * 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; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get recurring scans state. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set recurring scans state. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/IdParsingUtils.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..3561f5ec46737 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..0e316bb409f93 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentImpl.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.ManagedInstanceVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.VulnerabilityAssessmentRecurringScansProperties; + +class ManagedInstanceVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements ManagedInstanceVulnerabilityAssessment, ManagedInstanceVulnerabilityAssessment.Definition, ManagedInstanceVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + + ManagedInstanceVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new ManagedInstanceVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.managedInstanceName = name; + // + } + + ManagedInstanceVulnerabilityAssessmentImpl(ManagedInstanceVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.managedInstanceName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedInstanceVulnerabilityAssessmentsInner client = this.manager().inner().managedInstanceVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedInstanceVulnerabilityAssessmentsInner client = this.manager().inner().managedInstanceVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedInstanceVulnerabilityAssessmentsInner client = this.manager().inner().managedInstanceVulnerabilityAssessments(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName); + } + + @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 VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..7c5833ba25025 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentInner.java @@ -0,0 +1,131 @@ +/** + * 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.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed instance vulnerability assessment. + */ +@JsonFlatten +public class ManagedInstanceVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..8f1807d7e20ac --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.ManagedInstanceVulnerabilityAssessments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceVulnerabilityAssessment; +import com.microsoft.azure.Page; +import rx.Completable; + +class ManagedInstanceVulnerabilityAssessmentsImpl extends WrapperImpl implements ManagedInstanceVulnerabilityAssessments { + private final SqlManager manager; + + ManagedInstanceVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().managedInstanceVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl defineVulnerabilityAssessment(String name) { + return wrapVulnerabilityAssessmentModel(name); + } + + private ManagedInstanceVulnerabilityAssessmentImpl wrapVulnerabilityAssessmentModel(String name) { + return new ManagedInstanceVulnerabilityAssessmentImpl(name, this.manager()); + } + + private ManagedInstanceVulnerabilityAssessmentImpl wrapManagedInstanceVulnerabilityAssessmentModel(ManagedInstanceVulnerabilityAssessmentInner inner) { + return new ManagedInstanceVulnerabilityAssessmentImpl(inner, manager()); + } + + private Observable getManagedInstanceVulnerabilityAssessmentInnerUsingManagedInstanceVulnerabilityAssessmentsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + ManagedInstanceVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstanceVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedInstanceVulnerabilityAssessment call(ManagedInstanceVulnerabilityAssessmentInner inner) { + return wrapManagedInstanceVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedInstanceVulnerabilityAssessmentsInner 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 ManagedInstanceVulnerabilityAssessment call(ManagedInstanceVulnerabilityAssessmentInner inner) { + return wrapManagedInstanceVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstanceVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..a1ee134715b38 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java @@ -0,0 +1,590 @@ +/** + * 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 ManagedInstanceVulnerabilityAssessments. + */ +public class ManagedInstanceVulnerabilityAssessmentsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.ManagedInstanceVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceVulnerabilityAssessmentInner 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.ManagedInstanceVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.ManagedInstanceVulnerabilityAssessments listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments") + 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.ManagedInstanceVulnerabilityAssessments listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 ManagedInstanceVulnerabilityAssessmentInner object if successful. + */ + public ManagedInstanceVulnerabilityAssessmentInner get(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedInstanceVulnerabilityAssessmentInner>() { + @Override + public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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 managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 ManagedInstanceVulnerabilityAssessmentInner object if successful. + */ + public ManagedInstanceVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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, ManagedInstanceVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceVulnerabilityAssessmentInner>() { + @Override + public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner 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); + final String vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String managedInstanceName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 deleteAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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); + } + + /** + * Gets the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments 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<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments 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> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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> 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 the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> object + */ + public Observable> listByInstanceNextAsync(final String nextPageLink) { + return listByInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> 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/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PageImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..488d72189ea57 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..54eec7db0bc6c --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentImpl.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.ServerVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.VulnerabilityAssessmentRecurringScansProperties; + +class ServerVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements ServerVulnerabilityAssessment, ServerVulnerabilityAssessment.Definition, ServerVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new ServerVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerVulnerabilityAssessmentImpl(ServerVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerVulnerabilityAssessmentsInner client = this.manager().inner().serverVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerVulnerabilityAssessmentsInner client = this.manager().inner().serverVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerVulnerabilityAssessmentsInner client = this.manager().inner().serverVulnerabilityAssessments(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @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 VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerVulnerabilityAssessmentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..d171928b3733c --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentInner.java @@ -0,0 +1,131 @@ +/** + * 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.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server vulnerability assessment. + */ +@JsonFlatten +public class ServerVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..1a8d677eaaf3c --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.ServerVulnerabilityAssessments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerVulnerabilityAssessment; +import com.microsoft.azure.Page; +import rx.Completable; + +class ServerVulnerabilityAssessmentsImpl extends WrapperImpl implements ServerVulnerabilityAssessments { + private final SqlManager manager; + + ServerVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().serverVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerVulnerabilityAssessmentImpl defineVulnerabilityAssessment(String name) { + return wrapVulnerabilityAssessmentModel(name); + } + + private ServerVulnerabilityAssessmentImpl wrapVulnerabilityAssessmentModel(String name) { + return new ServerVulnerabilityAssessmentImpl(name, this.manager()); + } + + private ServerVulnerabilityAssessmentImpl wrapServerVulnerabilityAssessmentModel(ServerVulnerabilityAssessmentInner inner) { + return new ServerVulnerabilityAssessmentImpl(inner, manager()); + } + + private Observable getServerVulnerabilityAssessmentInnerUsingServerVulnerabilityAssessmentsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + ServerVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerVulnerabilityAssessment call(ServerVulnerabilityAssessmentInner inner) { + return wrapServerVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerVulnerabilityAssessmentsInner 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 ServerVulnerabilityAssessment call(ServerVulnerabilityAssessmentInner inner) { + return wrapServerVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName) { + ServerVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..b7f0cbf684ab2 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsInner.java @@ -0,0 +1,590 @@ +/** + * 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 ServerVulnerabilityAssessments. + */ +public class ServerVulnerabilityAssessmentsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ServerVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.ServerVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.ServerVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body ServerVulnerabilityAssessmentInner 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.ServerVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.ServerVulnerabilityAssessments listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments") + 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.ServerVulnerabilityAssessments listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 ServerVulnerabilityAssessmentInner object if successful. + */ + public ServerVulnerabilityAssessmentInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerVulnerabilityAssessmentInner>() { + @Override + public ServerVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, vulnerabilityAssessmentName, 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 server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 ServerVulnerabilityAssessmentInner object if successful. + */ + public ServerVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String serverName, ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 serverName, ServerVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerVulnerabilityAssessmentInner>() { + @Override + public ServerVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerVulnerabilityAssessmentInner 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 (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 vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String serverName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 deleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, serverName, vulnerabilityAssessmentName, 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment policies associated with 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment policies associated with 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..b0edb41522bb5 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java @@ -0,0 +1,210 @@ +/** + * 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.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ManagedInstanceVulnerabilityAssessmentsInner object to access its operations. + */ + private ManagedInstanceVulnerabilityAssessmentsInner managedInstanceVulnerabilityAssessments; + + /** + * Gets the ManagedInstanceVulnerabilityAssessmentsInner object to access its operations. + * @return the ManagedInstanceVulnerabilityAssessmentsInner object. + */ + public ManagedInstanceVulnerabilityAssessmentsInner managedInstanceVulnerabilityAssessments() { + return this.managedInstanceVulnerabilityAssessments; + } + + /** + * The ServerVulnerabilityAssessmentsInner object to access its operations. + */ + private ServerVulnerabilityAssessmentsInner serverVulnerabilityAssessments; + + /** + * Gets the ServerVulnerabilityAssessmentsInner object to access its operations. + * @return the ServerVulnerabilityAssessmentsInner object. + */ + public ServerVulnerabilityAssessmentsInner serverVulnerabilityAssessments() { + return this.serverVulnerabilityAssessments; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-06-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2018-06-01-preview"); + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java new file mode 100644 index 0000000000000..2a9cdb27818f1 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.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 com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +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.ManagedInstanceVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerVulnerabilityAssessments; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments; + private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ManagedInstanceVulnerabilityAssessments. + */ + public ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments() { + if (this.managedInstanceVulnerabilityAssessments == null) { + this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsImpl(this); + } + return this.managedInstanceVulnerabilityAssessments; + } + + /** + * @return Entry point to manage ServerVulnerabilityAssessments. + */ + public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { + if (this.serverVulnerabilityAssessments == null) { + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsImpl(this); + } + return this.serverVulnerabilityAssessments; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/package-info.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..d0c8aa91148ec --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2018_06_01_preview.implementation; diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/package-info.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/package-info.java new file mode 100644 index 0000000000000..5465e40d6a159 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2018_06_01_preview; diff --git a/sql/resource-manager/v3_2014_04/pom.xml b/sql/resource-manager/v3_2014_04/pom.xml new file mode 100644 index 0000000000000..8dd4daaccf4c3 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v3_2014_04 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/AuthenticationType.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/AuthenticationType.java new file mode 100644 index 0000000000000..acbe2ade964a4 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/AuthenticationType.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AuthenticationType. + */ +public enum AuthenticationType { + /** Enum value SQL. */ + SQL("SQL"), + + /** Enum value ADPassword. */ + ADPASSWORD("ADPassword"); + + /** The actual serialized value for a AuthenticationType instance. */ + private String value; + + AuthenticationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AuthenticationType instance. + * + * @param value the serialized value to parse. + * @return the parsed AuthenticationType object, or null if unable to parse. + */ + @JsonCreator + public static AuthenticationType fromString(String value) { + AuthenticationType[] items = AuthenticationType.values(); + for (AuthenticationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityReason.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..08607d66656d1 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityReason.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CheckNameAvailabilityReason. + */ +public enum CheckNameAvailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a CheckNameAvailabilityReason instance. */ + private String value; + + CheckNameAvailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CheckNameAvailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed CheckNameAvailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String value) { + CheckNameAvailabilityReason[] items = CheckNameAvailabilityReason.values(); + for (CheckNameAvailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityRequest.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..247823ab4688b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityRequest.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A request to check whether the specified name for a resource is available. + */ +public class CheckNameAvailabilityRequest { + /** + * The name whose availability is to be checked. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of resource that is used as the scope of the availability + * check. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + * @param name the name whose availability is to be checked. + */ + public CheckNameAvailabilityRequest() { + type = "Microsoft.Sql/servers"; + } + + /** + * Get the name whose availability is to be checked. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name whose availability is to be checked. + * + * @param name the name value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of resource that is used as the scope of the availability check. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of resource that is used as the scope of the availability check. + * + * @param type the type value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityResponse.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..cc304d6d69f31 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/CheckNameAvailabilityResponse.java @@ -0,0 +1,40 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.CheckNameAvailabilityResponseInner; + +/** + * Type representing CheckNameAvailabilityResponse. + */ +public interface CheckNameAvailabilityResponse extends HasInner, HasManager { + /** + * @return the available value. + */ + Boolean available(); + + /** + * @return the message value. + */ + String message(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingFunction.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingFunction.java new file mode 100644 index 0000000000000..2251be7680cf4 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingFunction.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DataMaskingFunction. + */ +public enum DataMaskingFunction { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value CCN. */ + CCN("CCN"), + + /** Enum value Email. */ + EMAIL("Email"), + + /** Enum value Number. */ + NUMBER("Number"), + + /** Enum value SSN. */ + SSN("SSN"), + + /** Enum value Text. */ + TEXT("Text"); + + /** The actual serialized value for a DataMaskingFunction instance. */ + private String value; + + DataMaskingFunction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingFunction instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingFunction object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingFunction fromString(String value) { + DataMaskingFunction[] items = DataMaskingFunction.values(); + for (DataMaskingFunction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicies.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicies.java new file mode 100644 index 0000000000000..96f4dff08ca32 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.DataMaskingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataMaskingPolicies. + */ +public interface DataMaskingPolicies extends SupportsCreating, HasInner { + /** + * Gets a database data masking 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicy.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicy.java new file mode 100644 index 0000000000000..0da17fe0cc23a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingPolicy.java @@ -0,0 +1,145 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.DataMaskingPolicyInner; +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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing DataMaskingPolicy. + */ +public interface DataMaskingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the applicationPrincipals value. + */ + String applicationPrincipals(); + + /** + * @return the dataMaskingState value. + */ + DataMaskingState dataMaskingState(); + + /** + * @return the exemptPrincipals value. + */ + String exemptPrincipals(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maskingLevel value. + */ + String maskingLevel(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataMaskingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithDataMaskingState, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataMaskingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataMaskingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the datamaskingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithDataMaskingState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the datamaskingpolicy definition allowing to specify DataMaskingState. + */ + interface WithDataMaskingState { + /** + * Specifies dataMaskingState. + */ + WithCreate withDataMaskingState(DataMaskingState dataMaskingState); + } + + /** + * The stage of the datamaskingpolicy definition allowing to specify ExemptPrincipals. + */ + interface WithExemptPrincipals { + /** + * Specifies exemptPrincipals. + */ + WithCreate withExemptPrincipals(String exemptPrincipals); + } + + /** + * 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.WithExemptPrincipals { + } + } + /** + * The template for a DataMaskingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithExemptPrincipals { + } + + /** + * Grouping of DataMaskingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the datamaskingpolicy update allowing to specify ExemptPrincipals. + */ + interface WithExemptPrincipals { + /** + * Specifies exemptPrincipals. + */ + Update withExemptPrincipals(String exemptPrincipals); + } + + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRule.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRule.java new file mode 100644 index 0000000000000..60c116cbbfb5f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRule.java @@ -0,0 +1,334 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.DataMaskingRuleInner; +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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing DataMaskingRule. + */ +public interface DataMaskingRule extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the aliasName value. + */ + String aliasName(); + + /** + * @return the columnName value. + */ + String columnName(); + + /** + * @return the dataMaskingRuleId value. + */ + String dataMaskingRuleId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maskingFunction value. + */ + DataMaskingFunction maskingFunction(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberFrom value. + */ + String numberFrom(); + + /** + * @return the numberTo value. + */ + String numberTo(); + + /** + * @return the prefixSize value. + */ + String prefixSize(); + + /** + * @return the replacementString value. + */ + String replacementString(); + + /** + * @return the ruleState value. + */ + DataMaskingRuleState ruleState(); + + /** + * @return the schemaName value. + */ + String schemaName(); + + /** + * @return the suffixSize value. + */ + String suffixSize(); + + /** + * @return the tableName value. + */ + String tableName(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataMaskingRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDataMaskingPolicy, DefinitionStages.WithColumnName, DefinitionStages.WithMaskingFunction, DefinitionStages.WithSchemaName, DefinitionStages.WithTableName, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataMaskingRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataMaskingRule definition. + */ + interface Blank extends WithDataMaskingPolicy { + } + + /** + * The stage of the datamaskingrule definition allowing to specify DataMaskingPolicy. + */ + interface WithDataMaskingPolicy { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithColumnName withExistingDataMaskingPolicy(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify ColumnName. + */ + interface WithColumnName { + /** + * Specifies columnName. + */ + WithMaskingFunction withColumnName(String columnName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify MaskingFunction. + */ + interface WithMaskingFunction { + /** + * Specifies maskingFunction. + */ + WithSchemaName withMaskingFunction(DataMaskingFunction maskingFunction); + } + + /** + * The stage of the datamaskingrule definition allowing to specify SchemaName. + */ + interface WithSchemaName { + /** + * Specifies schemaName. + */ + WithTableName withSchemaName(String schemaName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify TableName. + */ + interface WithTableName { + /** + * Specifies tableName. + */ + WithCreate withTableName(String tableName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify AliasName. + */ + interface WithAliasName { + /** + * Specifies aliasName. + */ + WithCreate withAliasName(String aliasName); + } + + /** + * The stage of the datamaskingrule definition allowing to specify NumberFrom. + */ + interface WithNumberFrom { + /** + * Specifies numberFrom. + */ + WithCreate withNumberFrom(String numberFrom); + } + + /** + * The stage of the datamaskingrule definition allowing to specify NumberTo. + */ + interface WithNumberTo { + /** + * Specifies numberTo. + */ + WithCreate withNumberTo(String numberTo); + } + + /** + * The stage of the datamaskingrule definition allowing to specify PrefixSize. + */ + interface WithPrefixSize { + /** + * Specifies prefixSize. + */ + WithCreate withPrefixSize(String prefixSize); + } + + /** + * The stage of the datamaskingrule definition allowing to specify ReplacementString. + */ + interface WithReplacementString { + /** + * Specifies replacementString. + */ + WithCreate withReplacementString(String replacementString); + } + + /** + * The stage of the datamaskingrule definition allowing to specify RuleState. + */ + interface WithRuleState { + /** + * Specifies ruleState. + */ + WithCreate withRuleState(DataMaskingRuleState ruleState); + } + + /** + * The stage of the datamaskingrule definition allowing to specify SuffixSize. + */ + interface WithSuffixSize { + /** + * Specifies suffixSize. + */ + WithCreate withSuffixSize(String suffixSize); + } + + /** + * 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.WithAliasName, DefinitionStages.WithNumberFrom, DefinitionStages.WithNumberTo, DefinitionStages.WithPrefixSize, DefinitionStages.WithReplacementString, DefinitionStages.WithRuleState, DefinitionStages.WithSuffixSize { + } + } + /** + * The template for a DataMaskingRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAliasName, UpdateStages.WithNumberFrom, UpdateStages.WithNumberTo, UpdateStages.WithPrefixSize, UpdateStages.WithReplacementString, UpdateStages.WithRuleState, UpdateStages.WithSuffixSize { + } + + /** + * Grouping of DataMaskingRule update stages. + */ + interface UpdateStages { + /** + * The stage of the datamaskingrule update allowing to specify AliasName. + */ + interface WithAliasName { + /** + * Specifies aliasName. + */ + Update withAliasName(String aliasName); + } + + /** + * The stage of the datamaskingrule update allowing to specify NumberFrom. + */ + interface WithNumberFrom { + /** + * Specifies numberFrom. + */ + Update withNumberFrom(String numberFrom); + } + + /** + * The stage of the datamaskingrule update allowing to specify NumberTo. + */ + interface WithNumberTo { + /** + * Specifies numberTo. + */ + Update withNumberTo(String numberTo); + } + + /** + * The stage of the datamaskingrule update allowing to specify PrefixSize. + */ + interface WithPrefixSize { + /** + * Specifies prefixSize. + */ + Update withPrefixSize(String prefixSize); + } + + /** + * The stage of the datamaskingrule update allowing to specify ReplacementString. + */ + interface WithReplacementString { + /** + * Specifies replacementString. + */ + Update withReplacementString(String replacementString); + } + + /** + * The stage of the datamaskingrule update allowing to specify RuleState. + */ + interface WithRuleState { + /** + * Specifies ruleState. + */ + Update withRuleState(DataMaskingRuleState ruleState); + } + + /** + * The stage of the datamaskingrule update allowing to specify SuffixSize. + */ + interface WithSuffixSize { + /** + * Specifies suffixSize. + */ + Update withSuffixSize(String suffixSize); + } + + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRuleState.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRuleState.java new file mode 100644 index 0000000000000..1747b881b58a5 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRuleState.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DataMaskingRuleState. + */ +public enum DataMaskingRuleState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingRuleState instance. */ + private String value; + + DataMaskingRuleState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingRuleState instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingRuleState object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingRuleState fromString(String value) { + DataMaskingRuleState[] items = DataMaskingRuleState.values(); + for (DataMaskingRuleState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRules.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRules.java new file mode 100644 index 0000000000000..faabe8e19bcb4 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingRules.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.DataMaskingRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataMaskingRules. + */ +public interface DataMaskingRules extends SupportsCreating, HasInner { + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingState.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingState.java new file mode 100644 index 0000000000000..fc7d0c93de7b7 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DataMaskingState.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DataMaskingState. + */ +public enum DataMaskingState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingState instance. */ + private String value; + + DataMaskingState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataMaskingState instance. + * + * @param value the serialized value to parse. + * @return the parsed DataMaskingState object, or null if unable to parse. + */ + @JsonCreator + public static DataMaskingState fromString(String value) { + DataMaskingState[] items = DataMaskingState.values(); + for (DataMaskingState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseEdition.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseEdition.java new file mode 100644 index 0000000000000..6e9610b07f446 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseEdition.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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseEdition. + */ +public final class DatabaseEdition extends ExpandableStringEnum { + /** Static value Web for DatabaseEdition. */ + public static final DatabaseEdition WEB = fromString("Web"); + + /** Static value Business for DatabaseEdition. */ + public static final DatabaseEdition BUSINESS = fromString("Business"); + + /** Static value Basic for DatabaseEdition. */ + public static final DatabaseEdition BASIC = fromString("Basic"); + + /** Static value Standard for DatabaseEdition. */ + public static final DatabaseEdition STANDARD = fromString("Standard"); + + /** Static value Premium for DatabaseEdition. */ + public static final DatabaseEdition PREMIUM = fromString("Premium"); + + /** Static value PremiumRS for DatabaseEdition. */ + public static final DatabaseEdition PREMIUM_RS = fromString("PremiumRS"); + + /** Static value Free for DatabaseEdition. */ + public static final DatabaseEdition FREE = fromString("Free"); + + /** Static value Stretch for DatabaseEdition. */ + public static final DatabaseEdition STRETCH = fromString("Stretch"); + + /** Static value DataWarehouse for DatabaseEdition. */ + public static final DatabaseEdition DATA_WAREHOUSE = fromString("DataWarehouse"); + + /** Static value System for DatabaseEdition. */ + public static final DatabaseEdition SYSTEM = fromString("System"); + + /** Static value System2 for DatabaseEdition. */ + public static final DatabaseEdition SYSTEM2 = fromString("System2"); + + /** + * Creates or finds a DatabaseEdition from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseEdition + */ + @JsonCreator + public static DatabaseEdition fromString(String name) { + return fromString(name, DatabaseEdition.class); + } + + /** + * @return known DatabaseEdition values + */ + public static Collection values() { + return values(DatabaseEdition.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseSecurityAlertPolicy.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..e076172ede487 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseSecurityAlertPolicy.java @@ -0,0 +1,305 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing DatabaseSecurityAlertPolicy. + */ +public interface DatabaseSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the disabledAlerts value. + */ + String disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + String emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @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(); + + /** + * @return the useServerDefault value. + */ + SecurityAlertPolicyUseServerDefault useServerDefault(); + + /** + * 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. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(String disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(String emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + WithCreate withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + + /** + * 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.WithLocation, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint, DefinitionStages.WithUseServerDefault { + } + } + /** + * 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.WithLocation, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint, UpdateStages.WithUseServerDefault { + } + + /** + * Grouping of DatabaseSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databasesecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(String disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(String emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + Update withLocation(String location); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + Update withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseThreatDetectionPolicies.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseThreatDetectionPolicies.java new file mode 100644 index 0000000000000..8b43b3da96ce3 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseThreatDetectionPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.DatabaseThreatDetectionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseThreatDetectionPolicies. + */ +public interface DatabaseThreatDetectionPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's threat detection 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 database Threat Detection 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); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsage.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsage.java new file mode 100644 index 0000000000000..a7f6c4d812047 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsage.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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.DatabaseUsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing DatabaseUsage. + */ +public interface DatabaseUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nextResetTime value. + */ + DateTime nextResetTime(); + + /** + * @return the resourceName value. + */ + String resourceName(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsages.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsages.java new file mode 100644 index 0000000000000..95897d6e35c9c --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabaseUsages.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.DatabaseUsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseUsages. + */ +public interface DatabaseUsages extends HasInner { + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Databases.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Databases.java new file mode 100644 index 0000000000000..82cb128aeccb2 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Databases.java @@ -0,0 +1,72 @@ +/** + * 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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.DatabasisServerMetric; +import com.microsoft.azure.management.sql.v3_2014_04.DatabasisServerMetricDefinition; + +/** + * Type representing Databases. + */ +public interface Databases { + /** + * Begins definition for a new Extension resource. + * @param name resource name. + * @return the first stage of the new Extension definition. + */ + ImportExportResponse.DefinitionStages.Blank defineExtension(String name); + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters); + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters); + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter); + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetric.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetric.java new file mode 100644 index 0000000000000..06d4f21b815cb --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetric.java @@ -0,0 +1,52 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing DatabasisServerMetric. + */ +public interface DatabasisServerMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetricDefinition.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetricDefinition.java new file mode 100644 index 0000000000000..a04c67bfdbb1e --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/DatabasisServerMetricDefinition.java @@ -0,0 +1,46 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import java.util.List; + +/** + * Type representing DatabasisServerMetricDefinition. + */ +public interface DatabasisServerMetricDefinition extends HasInner, HasManager { + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * @return the unit value. + */ + UnitDefinitionType unit(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivities.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivities.java new file mode 100644 index 0000000000000..ab7ec9a0edb2a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivities.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ElasticPoolActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolActivities. + */ +public interface ElasticPoolActivities extends HasInner { + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivity.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivity.java new file mode 100644 index 0000000000000..e5db73d44b902 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolActivity.java @@ -0,0 +1,142 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ElasticPoolActivityInner; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ElasticPoolActivity. + */ +public interface ElasticPoolActivity extends HasInner, HasManager { + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationId value. + */ + UUID operationId(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the requestedDatabaseDtuCap value. + */ + Integer requestedDatabaseDtuCap(); + + /** + * @return the requestedDatabaseDtuGuarantee value. + */ + Integer requestedDatabaseDtuGuarantee(); + + /** + * @return the requestedDatabaseDtuMax value. + */ + Integer requestedDatabaseDtuMax(); + + /** + * @return the requestedDatabaseDtuMin value. + */ + Integer requestedDatabaseDtuMin(); + + /** + * @return the requestedDtu value. + */ + Integer requestedDtu(); + + /** + * @return the requestedDtuGuarantee value. + */ + Integer requestedDtuGuarantee(); + + /** + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * @return the requestedStorageLimitInGB value. + */ + Long requestedStorageLimitInGB(); + + /** + * @return the requestedStorageLimitInMB value. + */ + Integer requestedStorageLimitInMB(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivities.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivities.java new file mode 100644 index 0000000000000..050b0c5bcc06b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivities.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ElasticPoolDatabaseActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolDatabaseActivities. + */ +public interface ElasticPoolDatabaseActivities extends HasInner { + /** + * Returns activity on databases inside of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivity.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivity.java new file mode 100644 index 0000000000000..f9c5d55d15b27 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolDatabaseActivity.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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ElasticPoolDatabaseActivityInner; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ElasticPoolDatabaseActivity. + */ +public interface ElasticPoolDatabaseActivity extends HasInner, HasManager { + /** + * @return the currentElasticPoolName value. + */ + String currentElasticPoolName(); + + /** + * @return the currentServiceObjective value. + */ + String currentServiceObjective(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationId value. + */ + UUID operationId(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * @return the requestedServiceObjective value. + */ + String requestedServiceObjective(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolEdition.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolEdition.java new file mode 100644 index 0000000000000..0671a47701508 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolEdition.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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolEdition. + */ +public final class ElasticPoolEdition extends ExpandableStringEnum { + /** Static value Basic for ElasticPoolEdition. */ + public static final ElasticPoolEdition BASIC = fromString("Basic"); + + /** Static value Standard for ElasticPoolEdition. */ + public static final ElasticPoolEdition STANDARD = fromString("Standard"); + + /** Static value Premium for ElasticPoolEdition. */ + public static final ElasticPoolEdition PREMIUM = fromString("Premium"); + + /** + * Creates or finds a ElasticPoolEdition from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolEdition + */ + @JsonCreator + public static ElasticPoolEdition fromString(String name) { + return fromString(name, ElasticPoolEdition.class); + } + + /** + * @return known ElasticPoolEdition values + */ + public static Collection values() { + return values(ElasticPoolEdition.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetric.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetric.java new file mode 100644 index 0000000000000..f97f3c55ea40f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetric.java @@ -0,0 +1,52 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ElasticPoolServerMetric. + */ +public interface ElasticPoolServerMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetricDefinition.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetricDefinition.java new file mode 100644 index 0000000000000..5535e074f3288 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPoolServerMetricDefinition.java @@ -0,0 +1,46 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import java.util.List; + +/** + * Type representing ElasticPoolServerMetricDefinition. + */ +public interface ElasticPoolServerMetricDefinition extends HasInner, HasManager { + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * @return the unit value. + */ + UnitDefinitionType unit(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPools.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPools.java new file mode 100644 index 0000000000000..8ada2c8f1bc50 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ElasticPools.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolServerMetric; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolServerMetricDefinition; + +/** + * Type representing ElasticPools. + */ +public interface ElasticPools { + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter); + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ExportRequest.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ExportRequest.java new file mode 100644 index 0000000000000..c2d2d7463d700 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ExportRequest.java @@ -0,0 +1,175 @@ +/** + * 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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Export database parameters. + */ +public class ExportRequest { + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /** + * Get the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @param storageKeyType the storageKeyType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @param storageKey the storageKey value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storage uri to use. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storage uri to use. + * + * @param storageUri the storageUri value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the name of the SQL administrator. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the name of the SQL administrator. + * + * @param administratorLogin the administratorLogin value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the password of the SQL administrator. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the password of the SQL administrator. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @param authenticationType the authenticationType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRule.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRule.java new file mode 100644 index 0000000000000..96c50db3401ca --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRule.java @@ -0,0 +1,125 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.FirewallRuleInner; +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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing FirewallRule. + */ +public interface FirewallRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FirewallRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithEndIpAddress, DefinitionStages.WithStartIpAddress, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallRule definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the firewallrule definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithEndIpAddress withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the firewallrule definition allowing to specify EndIpAddress. + */ + interface WithEndIpAddress { + /** + * Specifies endIpAddress. + */ + WithStartIpAddress withEndIpAddress(String endIpAddress); + } + + /** + * The stage of the firewallrule definition allowing to specify StartIpAddress. + */ + interface WithStartIpAddress { + /** + * Specifies startIpAddress. + */ + WithCreate withStartIpAddress(String startIpAddress); + } + + /** + * 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 { + } + } + /** + * The template for a FirewallRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of FirewallRule update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRules.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRules.java new file mode 100644 index 0000000000000..dd8f36d261cdf --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/FirewallRules.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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.FirewallRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallRules. + */ +public interface FirewallRules extends SupportsCreating, HasInner { + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicies.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicies.java new file mode 100644 index 0000000000000..3bcae7b4ea7a2 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicies.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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.GeoBackupPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GeoBackupPolicies. + */ +public interface GeoBackupPolicies extends SupportsCreating, HasInner { + /** + * Gets a geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns a list of geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicy.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicy.java new file mode 100644 index 0000000000000..c979b343db699 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicy.java @@ -0,0 +1,125 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.GeoBackupPolicyInner; +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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing GeoBackupPolicy. + */ +public interface GeoBackupPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + GeoBackupPolicyState state(); + + /** + * @return the storageType value. + */ + String storageType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the GeoBackupPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of GeoBackupPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a GeoBackupPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the geobackuppolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the geobackuppolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(GeoBackupPolicyState state); + } + + /** + * 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 { + } + } + /** + * The template for a GeoBackupPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithState { + } + + /** + * Grouping of GeoBackupPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the geobackuppolicy update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + Update withState(GeoBackupPolicyState state); + } + + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicyState.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicyState.java new file mode 100644 index 0000000000000..4edc724071f42 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/GeoBackupPolicyState.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for GeoBackupPolicyState. + */ +public enum GeoBackupPolicyState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a GeoBackupPolicyState instance. */ + private String value; + + GeoBackupPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GeoBackupPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed GeoBackupPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static GeoBackupPolicyState fromString(String value) { + GeoBackupPolicyState[] items = GeoBackupPolicyState.values(); + for (GeoBackupPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExportResponse.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExportResponse.java new file mode 100644 index 0000000000000..a84249447804a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExportResponse.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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ImportExportResponseInner; +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.v3_2014_04.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing ImportExportResponse. + */ +public interface ImportExportResponse extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the blobUri value. + */ + String blobUri(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the queuedTime value. + */ + String queuedTime(); + + /** + * @return the requestId value. + */ + UUID requestId(); + + /** + * @return the requestType value. + */ + String requestType(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ImportExportResponse definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithOperationMode, DefinitionStages.WithStorageKey, DefinitionStages.WithStorageKeyType, DefinitionStages.WithStorageUri, DefinitionStages.WithCreate { + } + + /** + * Grouping of ImportExportResponse definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ImportExportResponse definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the importexportresponse definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithAdministratorLogin withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the importexportresponse definition allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithAdministratorLoginPassword withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the importexportresponse definition allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithOperationMode withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the importexportresponse definition allowing to specify OperationMode. + */ + interface WithOperationMode { + /** + * Specifies operationMode. + */ + WithStorageKey withOperationMode(String operationMode); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageKey. + */ + interface WithStorageKey { + /** + * Specifies storageKey. + */ + WithStorageKeyType withStorageKey(String storageKey); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageKeyType. + */ + interface WithStorageKeyType { + /** + * Specifies storageKeyType. + */ + WithStorageUri withStorageKeyType(StorageKeyType storageKeyType); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageUri. + */ + interface WithStorageUri { + /** + * Specifies storageUri. + */ + WithCreate withStorageUri(String storageUri); + } + + /** + * The stage of the importexportresponse definition allowing to specify AuthenticationType. + */ + interface WithAuthenticationType { + /** + * Specifies authenticationType. + */ + WithCreate withAuthenticationType(AuthenticationType authenticationType); + } + + /** + * The stage of the importexportresponse definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + */ + WithCreate withName(String name); + } + + /** + * The stage of the importexportresponse definition allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + */ + WithCreate withType(String type); + } + + /** + * 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.WithAuthenticationType, DefinitionStages.WithName, DefinitionStages.WithType { + } + } + /** + * The template for a ImportExportResponse update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuthenticationType, UpdateStages.WithName, UpdateStages.WithType { + } + + /** + * Grouping of ImportExportResponse update stages. + */ + interface UpdateStages { + /** + * The stage of the importexportresponse update allowing to specify AuthenticationType. + */ + interface WithAuthenticationType { + /** + * Specifies authenticationType. + */ + Update withAuthenticationType(AuthenticationType authenticationType); + } + + /** + * The stage of the importexportresponse update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + */ + Update withName(String name); + } + + /** + * The stage of the importexportresponse update allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + */ + Update withType(String type); + } + + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExtensionRequest.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExtensionRequest.java new file mode 100644 index 0000000000000..90feadcefd768 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportExtensionRequest.java @@ -0,0 +1,267 @@ +/** + * 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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Import database parameters. + */ +@JsonFlatten +public class ImportExtensionRequest { + /** + * The name of the extension. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The type of the extension. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "properties.storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "properties.storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "properties.storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "properties.authenticationType") + private AuthenticationType authenticationType; + + /** + * The type of import operation being performed. This is always Import. + */ + @JsonProperty(value = "properties.operationMode", required = true) + private String operationMode; + + /** + * Creates an instance of ImportExtensionRequest class. + * @param storageKeyType the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * @param storageKey the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * @param storageUri the storage uri to use. + * @param administratorLogin the name of the SQL administrator. + * @param administratorLoginPassword the password of the SQL administrator. + */ + public ImportExtensionRequest() { + operationMode = "Import"; + } + + /** + * Get the name of the extension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the extension. + * + * @param name the name value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of the extension. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the extension. + * + * @param type the type value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Get the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @param storageKeyType the storageKeyType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @param storageKey the storageKey value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storage uri to use. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storage uri to use. + * + * @param storageUri the storageUri value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the name of the SQL administrator. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the name of the SQL administrator. + * + * @param administratorLogin the administratorLogin value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the password of the SQL administrator. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the password of the SQL administrator. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @param authenticationType the authenticationType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the type of import operation being performed. This is always Import. + * + * @return the operationMode value + */ + public String operationMode() { + return this.operationMode; + } + + /** + * Set the type of import operation being performed. This is always Import. + * + * @param operationMode the operationMode value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withOperationMode(String operationMode) { + this.operationMode = operationMode; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportRequest.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportRequest.java new file mode 100644 index 0000000000000..3662752a86c56 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ImportRequest.java @@ -0,0 +1,132 @@ +/** + * 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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Import database parameters. + */ +public class ImportRequest extends ExportRequest { + /** + * The name of the database to import. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * The edition for the database being created. Possible values include: + * 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', + * 'Stretch', 'DataWarehouse', 'System', 'System2'. + */ + @JsonProperty(value = "edition", required = true) + private DatabaseEdition edition; + + /** + * The name of the service objective to assign to the database. Possible + * values include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "serviceObjectiveName", required = true) + private ServiceObjectiveName serviceObjectiveName; + + /** + * The maximum size for the newly imported database. + */ + @JsonProperty(value = "maxSizeBytes", required = true) + private String maxSizeBytes; + + /** + * Get the name of the database to import. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the name of the database to import. + * + * @param databaseName the databaseName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the edition for the database being created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition for the database being created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @param edition the edition value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the name of the service objective to assign to the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceObjectiveName value + */ + public ServiceObjectiveName serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Set the name of the service objective to assign to the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @param serviceObjectiveName the serviceObjectiveName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withServiceObjectiveName(ServiceObjectiveName serviceObjectiveName) { + this.serviceObjectiveName = serviceObjectiveName; + return this; + } + + /** + * Get the maximum size for the newly imported database. + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maximum size for the newly imported database. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricAvailability.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricAvailability.java new file mode 100644 index 0000000000000..6d5c7dbcd4b7d --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricAvailability.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A metric availability value. + */ +public class MetricAvailability { + /** + * The length of retention for the database metric. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /** + * The granularity of the database metric. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * Get the length of retention for the database metric. + * + * @return the retention value + */ + public String retention() { + return this.retention; + } + + /** + * Get the granularity of the database metric. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricName.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricName.java new file mode 100644 index 0000000000000..76a999a792fdb --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricName.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database metric name. + */ +public class MetricName { + /** + * The name of the database metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * The friendly name of the database metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the name of the database metric. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Get the friendly name of the database metric. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricValue.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricValue.java new file mode 100644 index 0000000000000..193ce49043343 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/MetricValue.java @@ -0,0 +1,108 @@ +/** + * 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.v3_2014_04; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents database metrics. + */ +public class MetricValue { + /** + * The number of values for the metric. + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Double count; + + /** + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /** + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /** + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /** + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** + * Get the number of values for the metric. + * + * @return the count value + */ + public Double count() { + return this.count; + } + + /** + * Get the average value of the metric. + * + * @return the average value + */ + public Double average() { + return this.average; + } + + /** + * Get the max value of the metric. + * + * @return the maximum value + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the min value of the metric. + * + * @return the minimum value + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the metric timestamp (ISO-8601 format). + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total value of the metric. + * + * @return the total value + */ + public Double total() { + return this.total; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/OperationImpact.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/OperationImpact.java new file mode 100644 index 0000000000000..908e2e43dbd95 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/OperationImpact.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. + */ + +package com.microsoft.azure.management.sql.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The impact of an operation, both in absolute and relative terms. + */ +public class OperationImpact { + /** + * The name of the impact dimension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The unit in which estimated impact to dimension is measured. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The absolute impact to dimension. + */ + @JsonProperty(value = "changeValueAbsolute", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueAbsolute; + + /** + * The relative impact to dimension (null if not applicable). + */ + @JsonProperty(value = "changeValueRelative", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueRelative; + + /** + * Get the name of the impact dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the unit in which estimated impact to dimension is measured. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the absolute impact to dimension. + * + * @return the changeValueAbsolute value + */ + public Double changeValueAbsolute() { + return this.changeValueAbsolute; + } + + /** + * Get the relative impact to dimension (null if not applicable). + * + * @return the changeValueRelative value + */ + public Double changeValueRelative() { + return this.changeValueRelative; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/PrimaryAggregationType.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/PrimaryAggregationType.java new file mode 100644 index 0000000000000..01840823694ea --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/PrimaryAggregationType.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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PrimaryAggregationType. + */ +public final class PrimaryAggregationType extends ExpandableStringEnum { + /** Static value None for PrimaryAggregationType. */ + public static final PrimaryAggregationType NONE = fromString("None"); + + /** Static value Average for PrimaryAggregationType. */ + public static final PrimaryAggregationType AVERAGE = fromString("Average"); + + /** Static value Count for PrimaryAggregationType. */ + public static final PrimaryAggregationType COUNT = fromString("Count"); + + /** Static value Minimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMUM = fromString("Minimum"); + + /** Static value Maximum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Total for PrimaryAggregationType. */ + public static final PrimaryAggregationType TOTAL = fromString("Total"); + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * @param name a name to look for + * @return the corresponding PrimaryAggregationType + */ + @JsonCreator + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** + * @return known PrimaryAggregationType values + */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPool.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPool.java new file mode 100644 index 0000000000000..56107ebcc3265 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPool.java @@ -0,0 +1,95 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.RecommendedElasticPoolInner; +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.v3_2014_04.implementation.SqlManager; +import java.util.List; +import com.microsoft.azure.Resource; +import org.joda.time.DateTime; + +/** + * Type representing RecommendedElasticPool. + */ +public interface RecommendedElasticPool extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the databaseDtuMax value. + */ + Double databaseDtuMax(); + + /** + * @return the databaseDtuMin value. + */ + Double databaseDtuMin(); + + /** + * @return the databaseEdition value. + */ + ElasticPoolEdition databaseEdition(); + + /** + * @return the databases value. + */ + List databases(); + + /** + * @return the dtu value. + */ + Double dtu(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxObservedDtu value. + */ + Double maxObservedDtu(); + + /** + * @return the maxObservedStorageMB value. + */ + Double maxObservedStorageMB(); + + /** + * @return the metrics value. + */ + List metrics(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the observationPeriodEnd value. + */ + DateTime observationPeriodEnd(); + + /** + * @return the observationPeriodStart value. + */ + DateTime observationPeriodStart(); + + /** + * @return the storageMB value. + */ + Double storageMB(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPoolMetric.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPoolMetric.java new file mode 100644 index 0000000000000..949ffb58d201e --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPoolMetric.java @@ -0,0 +1,36 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.RecommendedElasticPoolMetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RecommendedElasticPoolMetric. + */ +public interface RecommendedElasticPoolMetric extends HasInner, HasManager { + /** + * @return the dateTimeProperty value. + */ + DateTime dateTimeProperty(); + + /** + * @return the dtu value. + */ + Double dtu(); + + /** + * @return the sizeGB value. + */ + Double sizeGB(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPools.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPools.java new file mode 100644 index 0000000000000..ec33698b6a728 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedElasticPools.java @@ -0,0 +1,52 @@ +/** + * 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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.RecommendedElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPoolMetric; + +/** + * Type representing RecommendedElasticPools. + */ +public interface RecommendedElasticPools extends HasInner { + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndex.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndex.java new file mode 100644 index 0000000000000..61b0d0f1e2127 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndex.java @@ -0,0 +1,210 @@ +/** + * 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.v3_2014_04; + +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; + +/** + * Represents a database recommended index. + */ +@JsonFlatten +public class RecommendedIndex extends ProxyResource { + /** + * The proposed index action. You can create a missing index, drop an + * unused index, or rebuild an existing index to improve its performance. + * Possible values include: 'Create', 'Drop', 'Rebuild'. + */ + @JsonProperty(value = "properties.action", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexAction action; + + /** + * The current recommendation state. Possible values include: 'Active', + * 'Pending', 'Executing', 'Verifying', 'Pending Revert', 'Reverting', + * 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexState state; + + /** + * The UTC datetime showing when this resource was created (ISO8601 + * format). + */ + @JsonProperty(value = "properties.created", access = JsonProperty.Access.WRITE_ONLY) + private DateTime created; + + /** + * The UTC datetime of when was this resource last changed (ISO8601 + * format). + */ + @JsonProperty(value = "properties.lastModified", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModified; + + /** + * The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED + * COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', + * 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE'. + */ + @JsonProperty(value = "properties.indexType", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexType indexType; + + /** + * The schema where table to build index over resides. + */ + @JsonProperty(value = "properties.schema", access = JsonProperty.Access.WRITE_ONLY) + private String schema; + + /** + * The table on which to build index. + */ + @JsonProperty(value = "properties.table", access = JsonProperty.Access.WRITE_ONLY) + private String table; + + /** + * Columns over which to build index. + */ + @JsonProperty(value = "properties.columns", access = JsonProperty.Access.WRITE_ONLY) + private List columns; + + /** + * The list of column names to be included in the index. + */ + @JsonProperty(value = "properties.includedColumns", access = JsonProperty.Access.WRITE_ONLY) + private List includedColumns; + + /** + * The full build index script. + */ + @JsonProperty(value = "properties.indexScript", access = JsonProperty.Access.WRITE_ONLY) + private String indexScript; + + /** + * The estimated impact of doing recommended index action. + */ + @JsonProperty(value = "properties.estimatedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List estimatedImpact; + + /** + * The values reported after index action is complete. + */ + @JsonProperty(value = "properties.reportedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List reportedImpact; + + /** + * Get the proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild'. + * + * @return the action value + */ + public RecommendedIndexAction action() { + return this.action; + } + + /** + * Get the current recommendation state. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success'. + * + * @return the state value + */ + public RecommendedIndexState state() { + return this.state; + } + + /** + * Get the UTC datetime showing when this resource was created (ISO8601 format). + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Get the UTC datetime of when was this resource last changed (ISO8601 format). + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Get the type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE'. + * + * @return the indexType value + */ + public RecommendedIndexType indexType() { + return this.indexType; + } + + /** + * Get the schema where table to build index over resides. + * + * @return the schema value + */ + public String schema() { + return this.schema; + } + + /** + * Get the table on which to build index. + * + * @return the table value + */ + public String table() { + return this.table; + } + + /** + * Get columns over which to build index. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Get the list of column names to be included in the index. + * + * @return the includedColumns value + */ + public List includedColumns() { + return this.includedColumns; + } + + /** + * Get the full build index script. + * + * @return the indexScript value + */ + public String indexScript() { + return this.indexScript; + } + + /** + * Get the estimated impact of doing recommended index action. + * + * @return the estimatedImpact value + */ + public List estimatedImpact() { + return this.estimatedImpact; + } + + /** + * Get the values reported after index action is complete. + * + * @return the reportedImpact value + */ + public List reportedImpact() { + return this.reportedImpact; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexAction.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexAction.java new file mode 100644 index 0000000000000..122c232e1cea0 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexAction.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexAction. + */ +public enum RecommendedIndexAction { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Drop. */ + DROP("Drop"), + + /** Enum value Rebuild. */ + REBUILD("Rebuild"); + + /** The actual serialized value for a RecommendedIndexAction instance. */ + private String value; + + RecommendedIndexAction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexAction instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexAction object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexAction fromString(String value) { + RecommendedIndexAction[] items = RecommendedIndexAction.values(); + for (RecommendedIndexAction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexState.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexState.java new file mode 100644 index 0000000000000..5919c73b6be40 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexState.java @@ -0,0 +1,80 @@ +/** + * 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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexState. + */ +public enum RecommendedIndexState { + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Pending. */ + PENDING("Pending"), + + /** Enum value Executing. */ + EXECUTING("Executing"), + + /** Enum value Verifying. */ + VERIFYING("Verifying"), + + /** Enum value Pending Revert. */ + PENDING_REVERT("Pending Revert"), + + /** Enum value Reverting. */ + REVERTING("Reverting"), + + /** Enum value Reverted. */ + REVERTED("Reverted"), + + /** Enum value Ignored. */ + IGNORED("Ignored"), + + /** Enum value Expired. */ + EXPIRED("Expired"), + + /** Enum value Blocked. */ + BLOCKED("Blocked"), + + /** Enum value Success. */ + SUCCESS("Success"); + + /** The actual serialized value for a RecommendedIndexState instance. */ + private String value; + + RecommendedIndexState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexState instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexState object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexState fromString(String value) { + RecommendedIndexState[] items = RecommendedIndexState.values(); + for (RecommendedIndexState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexType.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexType.java new file mode 100644 index 0000000000000..3927ee816091e --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecommendedIndexType.java @@ -0,0 +1,59 @@ +/** + * 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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexType. + */ +public enum RecommendedIndexType { + /** Enum value CLUSTERED. */ + CLUSTERED("CLUSTERED"), + + /** Enum value NONCLUSTERED. */ + NONCLUSTERED("NONCLUSTERED"), + + /** Enum value COLUMNSTORE. */ + COLUMNSTORE("COLUMNSTORE"), + + /** Enum value CLUSTERED COLUMNSTORE. */ + CLUSTERED_COLUMNSTORE("CLUSTERED COLUMNSTORE"); + + /** The actual serialized value for a RecommendedIndexType instance. */ + private String value; + + RecommendedIndexType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexType instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexType object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexType fromString(String value) { + RecommendedIndexType[] items = RecommendedIndexType.values(); + for (RecommendedIndexType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabase.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabase.java new file mode 100644 index 0000000000000..ed613f168d77f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabase.java @@ -0,0 +1,58 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.RecoverableDatabaseInner; +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.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RecoverableDatabase. + */ +public interface RecoverableDatabase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the edition value. + */ + String edition(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastAvailableBackupDate value. + */ + DateTime lastAvailableBackupDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabases.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabases.java new file mode 100644 index 0000000000000..d4ce6fe260f6f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RecoverableDatabases.java @@ -0,0 +1,40 @@ +/** + * 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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.RecoverableDatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecoverableDatabases. + */ +public interface RecoverableDatabases extends HasInner { + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @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 serverName, String databaseName); + + /** + * Gets a list of recoverable 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLink.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLink.java new file mode 100644 index 0000000000000..9a873657fed59 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLink.java @@ -0,0 +1,93 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ReplicationLinkInner; +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.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ReplicationLink. + */ +public interface ReplicationLink extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the isTerminationAllowed value. + */ + Boolean isTerminationAllowed(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerDatabase value. + */ + String partnerDatabase(); + + /** + * @return the partnerLocation value. + */ + String partnerLocation(); + + /** + * @return the partnerRole value. + */ + ReplicationRole partnerRole(); + + /** + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the replicationMode value. + */ + String replicationMode(); + + /** + * @return the replicationState value. + */ + ReplicationState replicationState(); + + /** + * @return the role value. + */ + ReplicationRole role(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLinks.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLinks.java new file mode 100644 index 0000000000000..7113dcb595ae3 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationLinks.java @@ -0,0 +1,79 @@ +/** + * 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.v3_2014_04; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ReplicationLinksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReplicationLinks. + */ +public interface ReplicationLinks extends HasInner { + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationRole.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationRole.java new file mode 100644 index 0000000000000..ae82b1c800d29 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationRole.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReplicationRole. + */ +public enum ReplicationRole { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"), + + /** Enum value NonReadableSecondary. */ + NON_READABLE_SECONDARY("NonReadableSecondary"), + + /** Enum value Source. */ + SOURCE("Source"), + + /** Enum value Copy. */ + COPY("Copy"); + + /** The actual serialized value for a ReplicationRole instance. */ + private String value; + + ReplicationRole(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReplicationRole instance. + * + * @param value the serialized value to parse. + * @return the parsed ReplicationRole object, or null if unable to parse. + */ + @JsonCreator + public static ReplicationRole fromString(String value) { + ReplicationRole[] items = ReplicationRole.values(); + for (ReplicationRole item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationState.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationState.java new file mode 100644 index 0000000000000..9d6b0297ac7b5 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ReplicationState.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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReplicationState. + */ +public final class ReplicationState extends ExpandableStringEnum { + /** Static value PENDING for ReplicationState. */ + public static final ReplicationState PENDING = fromString("PENDING"); + + /** Static value SEEDING for ReplicationState. */ + public static final ReplicationState SEEDING = fromString("SEEDING"); + + /** Static value CATCH_UP for ReplicationState. */ + public static final ReplicationState CATCH_UP = fromString("CATCH_UP"); + + /** Static value SUSPENDED for ReplicationState. */ + public static final ReplicationState SUSPENDED = fromString("SUSPENDED"); + + /** + * Creates or finds a ReplicationState from its string representation. + * @param name a name to look for + * @return the corresponding ReplicationState + */ + @JsonCreator + public static ReplicationState fromString(String name) { + return fromString(name, ReplicationState.class); + } + + /** + * @return known ReplicationState values + */ + public static Collection values() { + return values(ReplicationState.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabase.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabase.java new file mode 100644 index 0000000000000..64268d960a185 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabase.java @@ -0,0 +1,83 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.RestorableDroppedDatabaseInner; +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.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RestorableDroppedDatabase. + */ +public interface RestorableDroppedDatabase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the deletionDate value. + */ + DateTime deletionDate(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the edition value. + */ + String edition(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeBytes value. + */ + String maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabases.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabases.java new file mode 100644 index 0000000000000..25e1ccbc5547f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/RestorableDroppedDatabases.java @@ -0,0 +1,40 @@ +/** + * 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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.RestorableDroppedDatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RestorableDroppedDatabases. + */ +public interface RestorableDroppedDatabases extends HasInner { + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId); + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyEmailAccountAdmins.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyEmailAccountAdmins.java new file mode 100644 index 0000000000000..e88d2a5b38dd7 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyEmailAccountAdmins.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyEmailAccountAdmins. + */ +public enum SecurityAlertPolicyEmailAccountAdmins { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyEmailAccountAdmins instance. */ + private String value; + + SecurityAlertPolicyEmailAccountAdmins(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyEmailAccountAdmins instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyEmailAccountAdmins object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyEmailAccountAdmins fromString(String value) { + SecurityAlertPolicyEmailAccountAdmins[] items = SecurityAlertPolicyEmailAccountAdmins.values(); + for (SecurityAlertPolicyEmailAccountAdmins item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyState.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..b4bdb6de2134f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/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.v3_2014_04; + +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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyUseServerDefault.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyUseServerDefault.java new file mode 100644 index 0000000000000..2b54313a33909 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SecurityAlertPolicyUseServerDefault.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyUseServerDefault. + */ +public enum SecurityAlertPolicyUseServerDefault { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyUseServerDefault instance. */ + private String value; + + SecurityAlertPolicyUseServerDefault(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyUseServerDefault instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyUseServerDefault object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyUseServerDefault fromString(String value) { + SecurityAlertPolicyUseServerDefault[] items = SecurityAlertPolicyUseServerDefault.values(); + for (SecurityAlertPolicyUseServerDefault item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrator.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrator.java new file mode 100644 index 0000000000000..45e60c86073aa --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrator.java @@ -0,0 +1,146 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.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.v3_2014_04.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.WithTenantId, 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. + */ + WithAdministratorType withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify AdministratorType. + */ + interface WithAdministratorType { + /** + * Specifies administratorType. + */ + WithLogin withAdministratorType(String administratorType); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify Login. + */ + interface WithLogin { + /** + * Specifies login. + */ + WithSid withLogin(String login); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify Sid. + */ + interface WithSid { + /** + * Specifies sid. + */ + WithTenantId withSid(UUID sid); + } + + /** + * The stage of the serverazureadadministrator definition allowing to specify TenantId. + */ + interface WithTenantId { + /** + * Specifies tenantId. + */ + 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 { + } + } + /** + * The template for a ServerAzureADAdministrator update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ServerAzureADAdministrator update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrators.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrators.java new file mode 100644 index 0000000000000..e2eb1afe2f131 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerAzureADAdministrators.java @@ -0,0 +1,51 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServerAzureADAdministratorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerAzureADAdministrators. + */ +public interface ServerAzureADAdministrators extends SupportsCreating, HasInner { + /** + * Returns an 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); + + /** + * Returns 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(String resourceGroupName, 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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLink.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLink.java new file mode 100644 index 0000000000000..c9be942d0c12e --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLink.java @@ -0,0 +1,125 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServerCommunicationLinkInner; +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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing ServerCommunicationLink. + */ +public interface ServerCommunicationLink extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerCommunicationLink definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithPartnerServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerCommunicationLink definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerCommunicationLink definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the servercommunicationlink definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithPartnerServer withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the servercommunicationlink definition allowing to specify PartnerServer. + */ + interface WithPartnerServer { + /** + * Specifies partnerServer. + */ + WithCreate withPartnerServer(String partnerServer); + } + + /** + * 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 { + } + } + /** + * The template for a ServerCommunicationLink update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPartnerServer { + } + + /** + * Grouping of ServerCommunicationLink update stages. + */ + interface UpdateStages { + /** + * The stage of the servercommunicationlink update allowing to specify PartnerServer. + */ + interface WithPartnerServer { + /** + * Specifies partnerServer. + */ + Update withPartnerServer(String partnerServer); + } + + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLinks.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLinks.java new file mode 100644 index 0000000000000..6de1cabc09273 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerCommunicationLinks.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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServerCommunicationLinksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerCommunicationLinks. + */ +public interface ServerCommunicationLinks extends SupportsCreating, HasInner { + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String communicationLinkName); + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String communicationLinkName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicies.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicies.java new file mode 100644 index 0000000000000..75cb220aa9634 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicies.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.v3_2014_04; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServerConnectionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerConnectionPolicies. + */ +public interface ServerConnectionPolicies extends SupportsCreating, HasInner { + /** + * Gets the server's secure connection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicy.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicy.java new file mode 100644 index 0000000000000..2e3ebe77b6ab6 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionPolicy.java @@ -0,0 +1,120 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServerConnectionPolicyInner; +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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing ServerConnectionPolicy. + */ +public interface ServerConnectionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the connectionType value. + */ + ServerConnectionType connectionType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerConnectionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithConnectionType, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerConnectionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerConnectionPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverconnectionpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithConnectionType withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverconnectionpolicy definition allowing to specify ConnectionType. + */ + interface WithConnectionType { + /** + * Specifies connectionType. + */ + WithCreate withConnectionType(ServerConnectionType connectionType); + } + + /** + * 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 { + } + } + /** + * The template for a ServerConnectionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithConnectionType { + } + + /** + * Grouping of ServerConnectionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the serverconnectionpolicy update allowing to specify ConnectionType. + */ + interface WithConnectionType { + /** + * Specifies connectionType. + */ + Update withConnectionType(ServerConnectionType connectionType); + } + + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionType.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionType.java new file mode 100644 index 0000000000000..7024312ca59fc --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerConnectionType.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ServerConnectionType. + */ +public enum ServerConnectionType { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Proxy. */ + PROXY("Proxy"), + + /** Enum value Redirect. */ + REDIRECT("Redirect"); + + /** The actual serialized value for a ServerConnectionType instance. */ + private String value; + + ServerConnectionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServerConnectionType instance. + * + * @param value the serialized value to parse. + * @return the parsed ServerConnectionType object, or null if unable to parse. + */ + @JsonCreator + public static ServerConnectionType fromString(String value) { + ServerConnectionType[] items = ServerConnectionType.values(); + for (ServerConnectionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsage.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsage.java new file mode 100644 index 0000000000000..c74cb06c50734 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsage.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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServerUsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ServerUsage. + */ +public interface ServerUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nextResetTime value. + */ + DateTime nextResetTime(); + + /** + * @return the resourceName value. + */ + String resourceName(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsages.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsages.java new file mode 100644 index 0000000000000..572429b339f30 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServerUsages.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServerUsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerUsages. + */ +public interface ServerUsages extends HasInner { + /** + * Returns server usages. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Servers.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Servers.java new file mode 100644 index 0000000000000..4811132a066af --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/Servers.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Servers. + */ +public interface Servers extends HasInner { + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String name); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjective.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjective.java new file mode 100644 index 0000000000000..23a558b1c6e50 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjective.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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServiceObjectiveInner; +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.v3_2014_04.implementation.SqlManager; + +/** + * Type representing ServiceObjective. + */ +public interface ServiceObjective extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the enabled value. + */ + boolean enabled(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isDefault value. + */ + boolean isDefault(); + + /** + * @return the isSystem value. + */ + boolean isSystem(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceObjectiveName value. + */ + String serviceObjectiveName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectiveName.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectiveName.java new file mode 100644 index 0000000000000..bc007843b70b5 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectiveName.java @@ -0,0 +1,230 @@ +/** + * 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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServiceObjectiveName. + */ +public final class ServiceObjectiveName extends ExpandableStringEnum { + /** Static value System for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM = fromString("System"); + + /** Static value System0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM0 = fromString("System0"); + + /** Static value System1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM1 = fromString("System1"); + + /** Static value System2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2 = fromString("System2"); + + /** Static value System3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3 = fromString("System3"); + + /** Static value System4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4 = fromString("System4"); + + /** Static value System2L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2L = fromString("System2L"); + + /** Static value System3L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3L = fromString("System3L"); + + /** Static value System4L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4L = fromString("System4L"); + + /** Static value Free for ServiceObjectiveName. */ + public static final ServiceObjectiveName FREE = fromString("Free"); + + /** Static value Basic for ServiceObjectiveName. */ + public static final ServiceObjectiveName BASIC = fromString("Basic"); + + /** Static value S0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S0 = fromString("S0"); + + /** Static value S1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S1 = fromString("S1"); + + /** Static value S2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S2 = fromString("S2"); + + /** Static value S3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S3 = fromString("S3"); + + /** Static value S4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S4 = fromString("S4"); + + /** Static value S6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S6 = fromString("S6"); + + /** Static value S7 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S7 = fromString("S7"); + + /** Static value S9 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S9 = fromString("S9"); + + /** Static value S12 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S12 = fromString("S12"); + + /** Static value P1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P1 = fromString("P1"); + + /** Static value P2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P2 = fromString("P2"); + + /** Static value P3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P3 = fromString("P3"); + + /** Static value P4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P4 = fromString("P4"); + + /** Static value P6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P6 = fromString("P6"); + + /** Static value P11 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P11 = fromString("P11"); + + /** Static value P15 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P15 = fromString("P15"); + + /** Static value PRS1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS1 = fromString("PRS1"); + + /** Static value PRS2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS2 = fromString("PRS2"); + + /** Static value PRS4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS4 = fromString("PRS4"); + + /** Static value PRS6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS6 = fromString("PRS6"); + + /** Static value DW100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW100 = fromString("DW100"); + + /** Static value DW200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW200 = fromString("DW200"); + + /** Static value DW300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW300 = fromString("DW300"); + + /** Static value DW400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW400 = fromString("DW400"); + + /** Static value DW500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW500 = fromString("DW500"); + + /** Static value DW600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW600 = fromString("DW600"); + + /** Static value DW1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000 = fromString("DW1000"); + + /** Static value DW1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1200 = fromString("DW1200"); + + /** Static value DW1000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000C = fromString("DW1000c"); + + /** Static value DW1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500 = fromString("DW1500"); + + /** Static value DW1500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500C = fromString("DW1500c"); + + /** Static value DW2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000 = fromString("DW2000"); + + /** Static value DW2000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000C = fromString("DW2000c"); + + /** Static value DW3000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000 = fromString("DW3000"); + + /** Static value DW2500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2500C = fromString("DW2500c"); + + /** Static value DW3000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000C = fromString("DW3000c"); + + /** Static value DW6000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000 = fromString("DW6000"); + + /** Static value DW5000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW5000C = fromString("DW5000c"); + + /** Static value DW6000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000C = fromString("DW6000c"); + + /** Static value DW7500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW7500C = fromString("DW7500c"); + + /** Static value DW10000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW10000C = fromString("DW10000c"); + + /** Static value DW15000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW15000C = fromString("DW15000c"); + + /** Static value DW30000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW30000C = fromString("DW30000c"); + + /** Static value DS100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS100 = fromString("DS100"); + + /** Static value DS200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS200 = fromString("DS200"); + + /** Static value DS300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS300 = fromString("DS300"); + + /** Static value DS400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS400 = fromString("DS400"); + + /** Static value DS500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS500 = fromString("DS500"); + + /** Static value DS600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS600 = fromString("DS600"); + + /** Static value DS1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1000 = fromString("DS1000"); + + /** Static value DS1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1200 = fromString("DS1200"); + + /** Static value DS1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1500 = fromString("DS1500"); + + /** Static value DS2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS2000 = fromString("DS2000"); + + /** Static value ElasticPool for ServiceObjectiveName. */ + public static final ServiceObjectiveName ELASTIC_POOL = fromString("ElasticPool"); + + /** + * Creates or finds a ServiceObjectiveName from its string representation. + * @param name a name to look for + * @return the corresponding ServiceObjectiveName + */ + @JsonCreator + public static ServiceObjectiveName fromString(String name) { + return fromString(name, ServiceObjectiveName.class); + } + + /** + * @return known ServiceObjectiveName values + */ + public static Collection values() { + return values(ServiceObjectiveName.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectives.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectives.java new file mode 100644 index 0000000000000..c04efa21d9cf0 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceObjectives.java @@ -0,0 +1,40 @@ +/** + * 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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServiceObjectivesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServiceObjectives. + */ +public interface ServiceObjectives extends HasInner { + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String serviceObjectiveName); + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisor.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisor.java new file mode 100644 index 0000000000000..c853dce975c79 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisor.java @@ -0,0 +1,135 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServiceTierAdvisorInner; +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.v3_2014_04.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ServiceTierAdvisor. + */ +public interface ServiceTierAdvisor extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the activeTimeRatio value. + */ + Double activeTimeRatio(); + + /** + * @return the avgDtu value. + */ + Double avgDtu(); + + /** + * @return the confidence value. + */ + double confidence(); + + /** + * @return the currentServiceLevelObjective value. + */ + String currentServiceLevelObjective(); + + /** + * @return the currentServiceLevelObjectiveId value. + */ + UUID currentServiceLevelObjectiveId(); + + /** + * @return the databaseSizeBasedRecommendationServiceLevelObjective value. + */ + String databaseSizeBasedRecommendationServiceLevelObjective(); + + /** + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value. + */ + UUID databaseSizeBasedRecommendationServiceLevelObjectiveId(); + + /** + * @return the disasterPlanBasedRecommendationServiceLevelObjective value. + */ + String disasterPlanBasedRecommendationServiceLevelObjective(); + + /** + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value. + */ + UUID disasterPlanBasedRecommendationServiceLevelObjectiveId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxDtu value. + */ + Double maxDtu(); + + /** + * @return the maxSizeInGB value. + */ + Double maxSizeInGB(); + + /** + * @return the minDtu value. + */ + Double minDtu(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the observationPeriodEnd value. + */ + DateTime observationPeriodEnd(); + + /** + * @return the observationPeriodStart value. + */ + DateTime observationPeriodStart(); + + /** + * @return the overallRecommendationServiceLevelObjective value. + */ + String overallRecommendationServiceLevelObjective(); + + /** + * @return the overallRecommendationServiceLevelObjectiveId value. + */ + UUID overallRecommendationServiceLevelObjectiveId(); + + /** + * @return the serviceLevelObjectiveUsageMetrics value. + */ + List serviceLevelObjectiveUsageMetrics(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageBasedRecommendationServiceLevelObjective value. + */ + String usageBasedRecommendationServiceLevelObjective(); + + /** + * @return the usageBasedRecommendationServiceLevelObjectiveId value. + */ + UUID usageBasedRecommendationServiceLevelObjectiveId(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisors.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisors.java new file mode 100644 index 0000000000000..805d0b84a5dac --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/ServiceTierAdvisors.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.ServiceTierAdvisorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServiceTierAdvisors. + */ +public interface ServiceTierAdvisors extends HasInner { + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName); + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SloUsageMetric.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SloUsageMetric.java new file mode 100644 index 0000000000000..534a41fff3f7b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/SloUsageMetric.java @@ -0,0 +1,72 @@ +/** + * 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.v3_2014_04; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Slo Usage Metric. + */ +public class SloUsageMetric { + /** + * The serviceLevelObjective for SLO usage metric. Possible values include: + * 'System', 'System0', 'System1', 'System2', 'System3', 'System4', + * 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', + * 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', + * 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', + * 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', + * 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', + * 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', + * 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', + * 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /** + * The serviceLevelObjectiveId for SLO usage metric. + */ + @JsonProperty(value = "serviceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID serviceLevelObjectiveId; + + /** + * Gets or sets inRangeTimeRatio for SLO usage metric. + */ + @JsonProperty(value = "inRangeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private double inRangeTimeRatio; + + /** + * Get the serviceLevelObjective for SLO usage metric. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceLevelObjective value + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the serviceLevelObjectiveId for SLO usage metric. + * + * @return the serviceLevelObjectiveId value + */ + public UUID serviceLevelObjectiveId() { + return this.serviceLevelObjectiveId; + } + + /** + * Get gets or sets inRangeTimeRatio for SLO usage metric. + * + * @return the inRangeTimeRatio value + */ + public double inRangeTimeRatio() { + return this.inRangeTimeRatio; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/StorageKeyType.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/StorageKeyType.java new file mode 100644 index 0000000000000..552047ec7d975 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/StorageKeyType.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for StorageKeyType. + */ +public enum StorageKeyType { + /** Enum value StorageAccessKey. */ + STORAGE_ACCESS_KEY("StorageAccessKey"), + + /** Enum value SharedAccessKey. */ + SHARED_ACCESS_KEY("SharedAccessKey"); + + /** The actual serialized value for a StorageKeyType instance. */ + private String value; + + StorageKeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StorageKeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed StorageKeyType object, or null if unable to parse. + */ + @JsonCreator + public static StorageKeyType fromString(String value) { + StorageKeyType[] items = StorageKeyType.values(); + for (StorageKeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryption.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryption.java new file mode 100644 index 0000000000000..fbc4f87099589 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryption.java @@ -0,0 +1,45 @@ +/** + * 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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.TransparentDataEncryptionInner; + +/** + * Type representing TransparentDataEncryption. + */ +public interface TransparentDataEncryption extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the status value. + */ + TransparentDataEncryptionStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivities.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivities.java new file mode 100644 index 0000000000000..da3f0c6a4173a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivities.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.TransparentDataEncryptionActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TransparentDataEncryptionActivities. + */ +public interface TransparentDataEncryptionActivities extends HasInner { + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivity.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivity.java new file mode 100644 index 0000000000000..55f4d3964ba23 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivity.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.v3_2014_04; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.TransparentDataEncryptionActivityInner; + +/** + * Type representing TransparentDataEncryptionActivity. + */ +public interface TransparentDataEncryptionActivity extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the percentComplete value. + */ + Double percentComplete(); + + /** + * @return the status value. + */ + TransparentDataEncryptionActivityStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivityStatus.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivityStatus.java new file mode 100644 index 0000000000000..bc1a05aac99c1 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionActivityStatus.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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TransparentDataEncryptionActivityStatus. + */ +public final class TransparentDataEncryptionActivityStatus extends ExpandableStringEnum { + /** Static value Encrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus ENCRYPTING = fromString("Encrypting"); + + /** Static value Decrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus DECRYPTING = fromString("Decrypting"); + + /** + * Creates or finds a TransparentDataEncryptionActivityStatus from its string representation. + * @param name a name to look for + * @return the corresponding TransparentDataEncryptionActivityStatus + */ + @JsonCreator + public static TransparentDataEncryptionActivityStatus fromString(String name) { + return fromString(name, TransparentDataEncryptionActivityStatus.class); + } + + /** + * @return known TransparentDataEncryptionActivityStatus values + */ + public static Collection values() { + return values(TransparentDataEncryptionActivityStatus.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionStatus.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionStatus.java new file mode 100644 index 0000000000000..fd227705b39ee --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptionStatus.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.v3_2014_04; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TransparentDataEncryptionStatus. + */ +public enum TransparentDataEncryptionStatus { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a TransparentDataEncryptionStatus instance. */ + private String value; + + TransparentDataEncryptionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TransparentDataEncryptionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed TransparentDataEncryptionStatus object, or null if unable to parse. + */ + @JsonCreator + public static TransparentDataEncryptionStatus fromString(String value) { + TransparentDataEncryptionStatus[] items = TransparentDataEncryptionStatus.values(); + for (TransparentDataEncryptionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptions.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptions.java new file mode 100644 index 0000000000000..9d6d223a20eb7 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/TransparentDataEncryptions.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.v3_2014_04; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.implementation.TransparentDataEncryptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TransparentDataEncryptions. + */ +public interface TransparentDataEncryptions extends HasInner { + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitDefinitionType.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitDefinitionType.java new file mode 100644 index 0000000000000..c2fe9540a7330 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitDefinitionType.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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnitDefinitionType. + */ +public final class UnitDefinitionType extends ExpandableStringEnum { + /** Static value Count for UnitDefinitionType. */ + public static final UnitDefinitionType COUNT = fromString("Count"); + + /** Static value Bytes for UnitDefinitionType. */ + public static final UnitDefinitionType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitDefinitionType. */ + public static final UnitDefinitionType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitDefinitionType. */ + public static final UnitDefinitionType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitDefinitionType. */ + public static final UnitDefinitionType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitDefinitionType. */ + public static final UnitDefinitionType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** + * Creates or finds a UnitDefinitionType from its string representation. + * @param name a name to look for + * @return the corresponding UnitDefinitionType + */ + @JsonCreator + public static UnitDefinitionType fromString(String name) { + return fromString(name, UnitDefinitionType.class); + } + + /** + * @return known UnitDefinitionType values + */ + public static Collection values() { + return values(UnitDefinitionType.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitType.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitType.java new file mode 100644 index 0000000000000..8a172c9458a3b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/UnitType.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.v3_2014_04; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnitType. + */ +public final class UnitType extends ExpandableStringEnum { + /** Static value count for UnitType. */ + public static final UnitType COUNT = fromString("count"); + + /** Static value bytes for UnitType. */ + public static final UnitType BYTES = fromString("bytes"); + + /** Static value seconds for UnitType. */ + public static final UnitType SECONDS = fromString("seconds"); + + /** Static value percent for UnitType. */ + public static final UnitType PERCENT = fromString("percent"); + + /** Static value countPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("countPerSecond"); + + /** Static value bytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("bytesPerSecond"); + + /** + * Creates or finds a UnitType from its string representation. + * @param name a name to look for + * @return the corresponding UnitType + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** + * @return known UnitType values + */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..64ecc718db797 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.CheckNameAvailabilityResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.CheckNameAvailabilityReason; + +class CheckNameAvailabilityResponseImpl extends WrapperImpl implements CheckNameAvailabilityResponse { + private final SqlManager manager; + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Boolean available() { + return this.inner().available(); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public CheckNameAvailabilityReason reason() { + return this.inner().reason(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..4eff80506e367 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,82 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A response indicating whether the specified name for a resource is + * available. + */ +public class CheckNameAvailabilityResponseInner { + /** + * True if the name is available, otherwise false. + */ + @JsonProperty(value = "available", access = JsonProperty.Access.WRITE_ONLY) + private Boolean available; + + /** + * A message explaining why the name is unavailable. Will be null if the + * name is available. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The name whose availability was checked. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The reason code explaining why the name is unavailable. Will be null if + * the name is available. Possible values include: 'Invalid', + * 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private CheckNameAvailabilityReason reason; + + /** + * Get true if the name is available, otherwise false. + * + * @return the available value + */ + public Boolean available() { + return this.available; + } + + /** + * Get a message explaining why the name is unavailable. Will be null if the name is available. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the name whose availability was checked. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the reason code explaining why the name is unavailable. Will be null if the name is available. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesImpl.java new file mode 100644 index 0000000000000..48ff7dd4385d7 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingPolicy; + +class DataMaskingPoliciesImpl extends WrapperImpl implements DataMaskingPolicies { + private final SqlManager manager; + + DataMaskingPoliciesImpl(SqlManager manager) { + super(manager.inner().dataMaskingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DataMaskingPolicyImpl define(String name) { + return wrapModel(name); + } + + private DataMaskingPolicyImpl wrapModel(DataMaskingPolicyInner inner) { + return new DataMaskingPolicyImpl(inner, manager()); + } + + private DataMaskingPolicyImpl wrapModel(String name) { + return new DataMaskingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DataMaskingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DataMaskingPolicy call(DataMaskingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesInner.java new file mode 100644 index 0000000000000..c9aeb98765005 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPoliciesInner.java @@ -0,0 +1,263 @@ +/** + * 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.v3_2014_04.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DataMaskingPolicies. + */ +public class DataMaskingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DataMaskingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataMaskingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DataMaskingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataMaskingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DataMaskingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.DataMaskingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Query("api-version") String apiVersion, @Body DataMaskingPolicyInner 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.v3_2014_04.DataMaskingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking 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 DataMaskingPolicyInner object if successful. + */ + public DataMaskingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking 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, DataMaskingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DataMaskingPolicyInner>() { + @Override + public DataMaskingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database data masking 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. + * @param parameters Parameters for creating or updating a data masking policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 dataMaskingPolicyName = "Default"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, this.client.apiVersion(), parameters, 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database data masking 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. + * @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 DataMaskingPolicyInner object if successful. + */ + public DataMaskingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database data masking 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. + * @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 data masking 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DataMaskingPolicyInner>() { + @Override + public DataMaskingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database data masking 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 dataMaskingPolicyName = "Default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, 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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyImpl.java new file mode 100644 index 0000000000000..f024d1a1b47f8 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyImpl.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. + */ + +package com.microsoft.azure.management.sql.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingState; + +class DataMaskingPolicyImpl extends CreatableUpdatableImpl implements DataMaskingPolicy, DataMaskingPolicy.Definition, DataMaskingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DataMaskingPolicyImpl(String name, SqlManager manager) { + super(name, new DataMaskingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DataMaskingPolicyImpl(DataMaskingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DataMaskingPoliciesInner client = this.manager().inner().dataMaskingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataMaskingPoliciesInner client = this.manager().inner().dataMaskingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataMaskingPoliciesInner client = this.manager().inner().dataMaskingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String applicationPrincipals() { + return this.inner().applicationPrincipals(); + } + + @Override + public DataMaskingState dataMaskingState() { + return this.inner().dataMaskingState(); + } + + @Override + public String exemptPrincipals() { + return this.inner().exemptPrincipals(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maskingLevel() { + return this.inner().maskingLevel(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataMaskingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DataMaskingPolicyImpl withDataMaskingState(DataMaskingState dataMaskingState) { + this.inner().withDataMaskingState(dataMaskingState); + return this; + } + + @Override + public DataMaskingPolicyImpl withExemptPrincipals(String exemptPrincipals) { + this.inner().withExemptPrincipals(exemptPrincipals); + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyInner.java new file mode 100644 index 0000000000000..216ec615fb3ac --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingPolicyInner.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. + */ + +package com.microsoft.azure.management.sql.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database data masking policy. + */ +@JsonFlatten +public class DataMaskingPolicyInner extends ProxyResource { + /** + * The state of the data masking policy. Possible values include: + * 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.dataMaskingState", required = true) + private DataMaskingState dataMaskingState; + + /** + * The list of the exempt principals. Specifies the semicolon-separated + * list of database users for which the data masking policy does not apply. + * The specified users receive data results without masking for all of the + * database queries. + */ + @JsonProperty(value = "properties.exemptPrincipals") + private String exemptPrincipals; + + /** + * The list of the application principals. This is a legacy parameter and + * is no longer used. + */ + @JsonProperty(value = "properties.applicationPrincipals", access = JsonProperty.Access.WRITE_ONLY) + private String applicationPrincipals; + + /** + * The masking level. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "properties.maskingLevel", access = JsonProperty.Access.WRITE_ONLY) + private String maskingLevel; + + /** + * The location of the data masking policy. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The kind of data masking policy. Metadata, used for Azure portal. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the state of the data masking policy. Possible values include: 'Disabled', 'Enabled'. + * + * @return the dataMaskingState value + */ + public DataMaskingState dataMaskingState() { + return this.dataMaskingState; + } + + /** + * Set the state of the data masking policy. Possible values include: 'Disabled', 'Enabled'. + * + * @param dataMaskingState the dataMaskingState value to set + * @return the DataMaskingPolicyInner object itself. + */ + public DataMaskingPolicyInner withDataMaskingState(DataMaskingState dataMaskingState) { + this.dataMaskingState = dataMaskingState; + return this; + } + + /** + * Get the list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. + * + * @return the exemptPrincipals value + */ + public String exemptPrincipals() { + return this.exemptPrincipals; + } + + /** + * Set the list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. + * + * @param exemptPrincipals the exemptPrincipals value to set + * @return the DataMaskingPolicyInner object itself. + */ + public DataMaskingPolicyInner withExemptPrincipals(String exemptPrincipals) { + this.exemptPrincipals = exemptPrincipals; + return this; + } + + /** + * Get the list of the application principals. This is a legacy parameter and is no longer used. + * + * @return the applicationPrincipals value + */ + public String applicationPrincipals() { + return this.applicationPrincipals; + } + + /** + * Get the masking level. This is a legacy parameter and is no longer used. + * + * @return the maskingLevel value + */ + public String maskingLevel() { + return this.maskingLevel; + } + + /** + * Get the location of the data masking policy. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the kind of data masking policy. Metadata, used for Azure portal. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleImpl.java new file mode 100644 index 0000000000000..d0d38796f0dee --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleImpl.java @@ -0,0 +1,235 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingRuleState; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingFunction; + +class DataMaskingRuleImpl extends CreatableUpdatableImpl implements DataMaskingRule, DataMaskingRule.Definition, DataMaskingRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String dataMaskingRuleName; + + DataMaskingRuleImpl(String name, SqlManager manager) { + super(name, new DataMaskingRuleInner()); + this.manager = manager; + // Set resource name + this.dataMaskingRuleName = name; + // + } + + DataMaskingRuleImpl(DataMaskingRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dataMaskingRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.dataMaskingRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DataMaskingRulesInner client = this.manager().inner().dataMaskingRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.dataMaskingRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataMaskingRulesInner client = this.manager().inner().dataMaskingRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.dataMaskingRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataMaskingRulesInner client = this.manager().inner().dataMaskingRules(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String aliasName() { + return this.inner().aliasName(); + } + + @Override + public String columnName() { + return this.inner().columnName(); + } + + @Override + public String dataMaskingRuleId() { + return this.inner().dataMaskingRuleId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public DataMaskingFunction maskingFunction() { + return this.inner().maskingFunction(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String numberFrom() { + return this.inner().numberFrom(); + } + + @Override + public String numberTo() { + return this.inner().numberTo(); + } + + @Override + public String prefixSize() { + return this.inner().prefixSize(); + } + + @Override + public String replacementString() { + return this.inner().replacementString(); + } + + @Override + public DataMaskingRuleState ruleState() { + return this.inner().ruleState(); + } + + @Override + public String schemaName() { + return this.inner().schemaName(); + } + + @Override + public String suffixSize() { + return this.inner().suffixSize(); + } + + @Override + public String tableName() { + return this.inner().tableName(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataMaskingRuleImpl withExistingDataMaskingPolicy(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DataMaskingRuleImpl withColumnName(String columnName) { + this.inner().withColumnName(columnName); + return this; + } + + @Override + public DataMaskingRuleImpl withMaskingFunction(DataMaskingFunction maskingFunction) { + this.inner().withMaskingFunction(maskingFunction); + return this; + } + + @Override + public DataMaskingRuleImpl withSchemaName(String schemaName) { + this.inner().withSchemaName(schemaName); + return this; + } + + @Override + public DataMaskingRuleImpl withTableName(String tableName) { + this.inner().withTableName(tableName); + return this; + } + + @Override + public DataMaskingRuleImpl withAliasName(String aliasName) { + this.inner().withAliasName(aliasName); + return this; + } + + @Override + public DataMaskingRuleImpl withNumberFrom(String numberFrom) { + this.inner().withNumberFrom(numberFrom); + return this; + } + + @Override + public DataMaskingRuleImpl withNumberTo(String numberTo) { + this.inner().withNumberTo(numberTo); + return this; + } + + @Override + public DataMaskingRuleImpl withPrefixSize(String prefixSize) { + this.inner().withPrefixSize(prefixSize); + return this; + } + + @Override + public DataMaskingRuleImpl withReplacementString(String replacementString) { + this.inner().withReplacementString(replacementString); + return this; + } + + @Override + public DataMaskingRuleImpl withRuleState(DataMaskingRuleState ruleState) { + this.inner().withRuleState(ruleState); + return this; + } + + @Override + public DataMaskingRuleImpl withSuffixSize(String suffixSize) { + this.inner().withSuffixSize(suffixSize); + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleInner.java new file mode 100644 index 0000000000000..0fd7bb5d658b2 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRuleInner.java @@ -0,0 +1,367 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingRuleState; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingFunction; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database data masking rule. + */ +@JsonFlatten +public class DataMaskingRuleInner extends ProxyResource { + /** + * The rule Id. + */ + @JsonProperty(value = "properties.id", access = JsonProperty.Access.WRITE_ONLY) + private String dataMaskingRuleId; + + /** + * The alias name. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "properties.aliasName") + private String aliasName; + + /** + * The rule state. Used to delete a rule. To delete an existing rule, + * specify the schemaName, tableName, columnName, maskingFunction, and + * specify ruleState as disabled. However, if the rule doesn't already + * exist, the rule will be created with ruleState set to enabled, + * regardless of the provided value of ruleState. Possible values include: + * 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.ruleState") + private DataMaskingRuleState ruleState; + + /** + * The schema name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.schemaName", required = true) + private String schemaName; + + /** + * The table name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.tableName", required = true) + private String tableName; + + /** + * The column name on which the data masking rule is applied. + */ + @JsonProperty(value = "properties.columnName", required = true) + private String columnName; + + /** + * The masking function that is used for the data masking rule. Possible + * values include: 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text'. + */ + @JsonProperty(value = "properties.maskingFunction", required = true) + private DataMaskingFunction maskingFunction; + + /** + * The numberFrom property of the masking rule. Required if maskingFunction + * is set to Number, otherwise this parameter will be ignored. + */ + @JsonProperty(value = "properties.numberFrom") + private String numberFrom; + + /** + * The numberTo property of the data masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be + * ignored. + */ + @JsonProperty(value = "properties.numberTo") + private String numberTo; + + /** + * If maskingFunction is set to Text, the number of characters to show + * unmasked in the beginning of the string. Otherwise, this parameter will + * be ignored. + */ + @JsonProperty(value = "properties.prefixSize") + private String prefixSize; + + /** + * If maskingFunction is set to Text, the number of characters to show + * unmasked at the end of the string. Otherwise, this parameter will be + * ignored. + */ + @JsonProperty(value = "properties.suffixSize") + private String suffixSize; + + /** + * If maskingFunction is set to Text, the character to use for masking the + * unexposed part of the string. Otherwise, this parameter will be ignored. + */ + @JsonProperty(value = "properties.replacementString") + private String replacementString; + + /** + * The location of the data masking rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The kind of Data Masking Rule. Metadata, used for Azure portal. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the rule Id. + * + * @return the dataMaskingRuleId value + */ + public String dataMaskingRuleId() { + return this.dataMaskingRuleId; + } + + /** + * Get the alias name. This is a legacy parameter and is no longer used. + * + * @return the aliasName value + */ + public String aliasName() { + return this.aliasName; + } + + /** + * Set the alias name. This is a legacy parameter and is no longer used. + * + * @param aliasName the aliasName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withAliasName(String aliasName) { + this.aliasName = aliasName; + return this; + } + + /** + * Get the rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'Disabled', 'Enabled'. + * + * @return the ruleState value + */ + public DataMaskingRuleState ruleState() { + return this.ruleState; + } + + /** + * Set the rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'Disabled', 'Enabled'. + * + * @param ruleState the ruleState value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withRuleState(DataMaskingRuleState ruleState) { + this.ruleState = ruleState; + return this; + } + + /** + * Get the schema name on which the data masking rule is applied. + * + * @return the schemaName value + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the schema name on which the data masking rule is applied. + * + * @param schemaName the schemaName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the table name on which the data masking rule is applied. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the table name on which the data masking rule is applied. + * + * @param tableName the tableName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the column name on which the data masking rule is applied. + * + * @return the columnName value + */ + public String columnName() { + return this.columnName; + } + + /** + * Set the column name on which the data masking rule is applied. + * + * @param columnName the columnName value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withColumnName(String columnName) { + this.columnName = columnName; + return this; + } + + /** + * Get the masking function that is used for the data masking rule. Possible values include: 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text'. + * + * @return the maskingFunction value + */ + public DataMaskingFunction maskingFunction() { + return this.maskingFunction; + } + + /** + * Set the masking function that is used for the data masking rule. Possible values include: 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text'. + * + * @param maskingFunction the maskingFunction value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withMaskingFunction(DataMaskingFunction maskingFunction) { + this.maskingFunction = maskingFunction; + return this; + } + + /** + * Get the numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @return the numberFrom value + */ + public String numberFrom() { + return this.numberFrom; + } + + /** + * Set the numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @param numberFrom the numberFrom value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withNumberFrom(String numberFrom) { + this.numberFrom = numberFrom; + return this; + } + + /** + * Get the numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @return the numberTo value + */ + public String numberTo() { + return this.numberTo; + } + + /** + * Set the numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. + * + * @param numberTo the numberTo value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withNumberTo(String numberTo) { + this.numberTo = numberTo; + return this; + } + + /** + * Get if maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. + * + * @return the prefixSize value + */ + public String prefixSize() { + return this.prefixSize; + } + + /** + * Set if maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. + * + * @param prefixSize the prefixSize value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withPrefixSize(String prefixSize) { + this.prefixSize = prefixSize; + return this; + } + + /** + * Get if maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. + * + * @return the suffixSize value + */ + public String suffixSize() { + return this.suffixSize; + } + + /** + * Set if maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. + * + * @param suffixSize the suffixSize value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withSuffixSize(String suffixSize) { + this.suffixSize = suffixSize; + return this; + } + + /** + * Get if maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. + * + * @return the replacementString value + */ + public String replacementString() { + return this.replacementString; + } + + /** + * Set if maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. + * + * @param replacementString the replacementString value to set + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withReplacementString(String replacementString) { + this.replacementString = replacementString; + return this; + } + + /** + * Get the location of the data masking rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the kind of Data Masking Rule. Metadata, used for Azure portal. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesImpl.java new file mode 100644 index 0000000000000..cf9c5e487ba58 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingRules; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingRule; + +class DataMaskingRulesImpl extends WrapperImpl implements DataMaskingRules { + private final SqlManager manager; + + DataMaskingRulesImpl(SqlManager manager) { + super(manager.inner().dataMaskingRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DataMaskingRuleImpl define(String name) { + return wrapModel(name); + } + + private DataMaskingRuleImpl wrapModel(DataMaskingRuleInner inner) { + return new DataMaskingRuleImpl(inner, manager()); + } + + private DataMaskingRuleImpl wrapModel(String name) { + return new DataMaskingRuleImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + DataMaskingRulesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DataMaskingRule call(DataMaskingRuleInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesInner.java new file mode 100644 index 0000000000000..c0a2fa8d5c808 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DataMaskingRulesInner.java @@ -0,0 +1,277 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DataMaskingRules. + */ +public class DataMaskingRulesInner { + /** The Retrofit service to perform REST calls. */ + private DataMaskingRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataMaskingRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DataMaskingRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataMaskingRules to be + * used by Retrofit to perform actually REST calls. + */ + interface DataMaskingRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.DataMaskingRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Path("dataMaskingRuleName") String dataMaskingRuleName, @Query("api-version") String apiVersion, @Body DataMaskingRuleInner 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.v3_2014_04.DataMaskingRules listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("dataMaskingPolicyName") String dataMaskingPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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 DataMaskingRuleInner object if successful. + */ + public DataMaskingRuleInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @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, String dataMaskingRuleName, DataMaskingRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingRuleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).map(new Func1, DataMaskingRuleInner>() { + @Override + public DataMaskingRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database data masking rule. + * + * @param resourceGroupName The 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. + * @param dataMaskingRuleName The name of the data masking rule. + * @param parameters The required parameters for creating or updating a data masking rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataMaskingRuleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataMaskingRuleName == null) { + throw new IllegalArgumentException("Parameter dataMaskingRuleName 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 dataMaskingPolicyName = "Default"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, dataMaskingRuleName, this.client.apiVersion(), parameters, 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 data masking rules. + * + * @param resourceGroupName The 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. + * @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 List<DataMaskingRuleInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataMaskingRuleInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database data masking rules. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataMaskingRuleInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 dataMaskingPolicyName = "Default"; + return service.listByDatabase(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, dataMaskingPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..ce7e2e9e9fa41 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,202 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.SecurityAlertPolicyState; +import com.microsoft.azure.management.sql.v3_2014_04.SecurityAlertPolicyEmailAccountAdmins; +import com.microsoft.azure.management.sql.v3_2014_04.SecurityAlertPolicyUseServerDefault; + +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(); + // resource ancestor names + 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() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public String emailAddresses() { + return this.inner().emailAddresses(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @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 SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.inner().useServerDefault(); + } + + @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(String disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAddresses(String emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withLocation(String location) { + this.inner().withLocation(location); + 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; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.inner().withUseServerDefault(useServerDefault); + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..f70846745d96b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,284 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.SecurityAlertPolicyState; +import com.microsoft.azure.management.sql.v3_2014_04.SecurityAlertPolicyEmailAccountAdmins; +import com.microsoft.azure.management.sql.v3_2014_04.SecurityAlertPolicyUseServerDefault; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Contains information about a database Threat Detection policy. + */ +@JsonFlatten +public class DatabaseSecurityAlertPolicyInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * and storageAccountAccessKey are required. Possible values include: + * 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies the semicolon-separated list of alerts that are disabled, or + * empty string to disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; + * Unsafe_Action. + */ + @JsonProperty(value = "properties.disabledAlerts") + private String disabledAlerts; + + /** + * Specifies the semicolon-separated list of e-mail addresses to which the + * alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private String emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. If state is Enabled, storageEndpoint is + * required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + */ + @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 whether to use the default server policy. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.useServerDefault") + private SecurityAlertPolicyUseServerDefault useServerDefault; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. 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 the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. + * + * @return the disabledAlerts value + */ + public String disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: 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(String disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies the semicolon-separated list of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public String emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies the semicolon-separated list 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(String emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. Possible values include: 'Enabled', 'Disabled'. + * + * @return the emailAccountAdmins value + */ + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. Possible values include: 'Enabled', 'Disabled'. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins 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. If state is Enabled, storageEndpoint is required. + * + * @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. If state is Enabled, storageEndpoint is required. + * + * @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. If state is Enabled, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. + * + * @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 whether to use the default server policy. Possible values include: 'Enabled', 'Disabled'. + * + * @return the useServerDefault value + */ + public SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.useServerDefault; + } + + /** + * Set specifies whether to use the default server policy. Possible values include: 'Enabled', 'Disabled'. + * + * @param useServerDefault the useServerDefault value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.useServerDefault = useServerDefault; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesImpl.java new file mode 100644 index 0000000000000..31de11b464edc --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseThreatDetectionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseSecurityAlertPolicy; + +class DatabaseThreatDetectionPoliciesImpl extends WrapperImpl implements DatabaseThreatDetectionPolicies { + private final SqlManager manager; + + DatabaseThreatDetectionPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseThreatDetectionPolicies()); + 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 getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseThreatDetectionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseSecurityAlertPolicy call(DatabaseSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesInner.java new file mode 100644 index 0000000000000..1176ccc723351 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseThreatDetectionPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v3_2014_04.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseThreatDetectionPolicies. + */ +public class DatabaseThreatDetectionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseThreatDetectionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseThreatDetectionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseThreatDetectionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseThreatDetectionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseThreatDetectionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseThreatDetectionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.DatabaseThreatDetectionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @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.v3_2014_04.DatabaseThreatDetectionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Body DatabaseSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's threat detection 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 database Threat Detection 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 threat detection 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 database Threat Detection 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 threat detection 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 database Threat Detection 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 threat detection 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 database Threat Detection 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 (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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, securityAlertPolicyName, 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 threat detection 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 database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 (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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, securityAlertPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageImpl.java new file mode 100644 index 0000000000000..6c2b9d5c68111 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class DatabaseUsageImpl extends WrapperImpl implements DatabaseUsage { + private final SqlManager manager; + + DatabaseUsageImpl(DatabaseUsageInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime nextResetTime() { + return this.inner().nextResetTime(); + } + + @Override + public String resourceName() { + return this.inner().resourceName(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageInner.java new file mode 100644 index 0000000000000..9fed49c7c87e0 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsageInner.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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The database usages. + */ +public class DatabaseUsageInner { + /** + * The name of the usage metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The name of the resource. + */ + @JsonProperty(value = "resourceName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceName; + + /** + * The usage metric display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The current value of the usage metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /** + * The current limit of the usage metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * The units of the usage metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The next reset time for the usage metric (ISO8601 format). + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime nextResetTime; + + /** + * Get the name of the usage metric. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the name of the resource. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the usage metric display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the current value of the usage metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the current limit of the usage metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get the units of the usage metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the next reset time for the usage metric (ISO8601 format). + * + * @return the nextResetTime value + */ + public DateTime nextResetTime() { + return this.nextResetTime; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesImpl.java new file mode 100644 index 0000000000000..3896e947db1c2 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseUsages; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseUsage; + +class DatabaseUsagesImpl extends WrapperImpl implements DatabaseUsages { + private final SqlManager manager; + + DatabaseUsagesImpl(SqlManager manager) { + super(manager.inner().databaseUsages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabaseUsageImpl wrapModel(DatabaseUsageInner inner) { + return new DatabaseUsageImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseUsagesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabaseUsage call(DatabaseUsageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesInner.java new file mode 100644 index 0000000000000..1665f8f2488ba --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabaseUsagesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseUsages. + */ +public class DatabaseUsagesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseUsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseUsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseUsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseUsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseUsages to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseUsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.DatabaseUsages listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @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 List<DatabaseUsageInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseUsageInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database usages. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseUsageInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..99fdda0efe053 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesImpl.java @@ -0,0 +1,116 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.Databases; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.ImportExportResponse; +import com.microsoft.azure.management.sql.v3_2014_04.ExportRequest; +import com.microsoft.azure.management.sql.v3_2014_04.ImportRequest; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.DatabasisServerMetric; +import com.microsoft.azure.management.sql.v3_2014_04.DatabasisServerMetricDefinition; + +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 ImportExportResponseImpl defineExtension(String name) { + return wrapExtensionModel(name); + } + + private ImportExportResponseImpl wrapExtensionModel(String name) { + return new ImportExportResponseImpl(name, this.manager()); + } + + private ImportExportResponseImpl wrapImportExportResponseModel(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + + private DatabasisServerMetricImpl wrapDatabasisServerMetricModel(MetricInner inner) { + return new DatabasisServerMetricImpl(inner, manager()); + } + + private DatabasisServerMetricDefinitionImpl wrapDatabasisServerMetricDefinitionModel(MetricDefinitionInner inner) { + return new DatabasisServerMetricDefinitionImpl(inner, manager()); + } + + @Override + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + DatabasesInner client = this.inner(); + return client.exportAsync(resourceGroupName, serverName, databaseName, parameters) + .map(new Func1() { + @Override + public ImportExportResponse call(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + DatabasesInner client = this.inner(); + return client.importMethodAsync(resourceGroupName, serverName, parameters) + .map(new Func1() { + @Override + public ImportExportResponse call(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter) { + DatabasesInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, serverName, databaseName, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisServerMetric call(MetricInner inner) { + return wrapDatabasisServerMetricModel(inner); + } + }); + } + + @Override + public Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.listMetricDefinitionsAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisServerMetricDefinition call(MetricDefinitionInner inner) { + return wrapDatabasisServerMetricDefinitionModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..b62a04905f521 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasesInner.java @@ -0,0 +1,845 @@ +/** + * 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.v3_2014_04.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2014_04.ExportRequest; +import com.microsoft.azure.management.sql.v3_2014_04.ImportExtensionRequest; +import com.microsoft.azure.management.sql.v3_2014_04.ImportRequest; +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.POST; +import retrofit2.http.PUT; +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.v3_2014_04.Databases importMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") + Observable> importMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest 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.v3_2014_04.Databases beginImportMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") + Observable> beginImportMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest 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.v3_2014_04.Databases createImportOperation" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") + Observable> createImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest 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.v3_2014_04.Databases beginCreateImportOperation" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") + Observable> beginCreateImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest 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.v3_2014_04.Databases export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> export(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest 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.v3_2014_04.Databases beginExport" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> beginExport(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest 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.v3_2014_04.Databases listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.v3_2014_04.Databases listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner importMethod(String resourceGroupName, String serverName, ImportRequest parameters) { + return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> importMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest 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); + Observable> observable = service.importMethod(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginImportMethod(String resourceGroupName, String serverName, ImportRequest parameters) { + return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginImportMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest 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); + return service.beginImportMethod(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginImportMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginImportMethodDelegate(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); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 extensionName = "import"; + Observable> observable = service.createImportOperation(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, extensionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginCreateImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a 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 beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginCreateImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 extensionName = "import"; + return service.beginCreateImportOperation(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, extensionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateImportOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateImportOperationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner export(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + Observable> observable = service.export(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginExport(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a 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 beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginExportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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); + return service.beginExport(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginExportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExportDelegate(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); + } + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String serverName, String databaseName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter).toBlocking().single().body(); + } + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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> listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter), serviceCallback); + } + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String serverName, String databaseName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String filter) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(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); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @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 List<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String serverName, String databaseName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String databaseName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricDefinitionsDelegate(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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricDefinitionImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricDefinitionImpl.java new file mode 100644 index 0000000000000..0384b94ac2413 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricDefinitionImpl.java @@ -0,0 +1,60 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DatabasisServerMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.MetricAvailability; +import com.microsoft.azure.management.sql.v3_2014_04.MetricName; +import com.microsoft.azure.management.sql.v3_2014_04.PrimaryAggregationType; +import com.microsoft.azure.management.sql.v3_2014_04.UnitDefinitionType; + +class DatabasisServerMetricDefinitionImpl extends WrapperImpl implements DatabasisServerMetricDefinition { + private final SqlManager manager; + + DatabasisServerMetricDefinitionImpl(MetricDefinitionInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public PrimaryAggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceUri() { + return this.inner().resourceUri(); + } + + @Override + public UnitDefinitionType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricImpl.java new file mode 100644 index 0000000000000..db4a9c3acaa11 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/DatabasisServerMetricImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.DatabasisServerMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.MetricValue; +import com.microsoft.azure.management.sql.v3_2014_04.MetricName; +import com.microsoft.azure.management.sql.v3_2014_04.UnitType; + +class DatabasisServerMetricImpl extends WrapperImpl implements DatabasisServerMetric { + private final SqlManager manager; + + DatabasisServerMetricImpl(MetricInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesImpl.java new file mode 100644 index 0000000000000..979c4e2e9affa --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolActivity; + +class ElasticPoolActivitiesImpl extends WrapperImpl implements ElasticPoolActivities { + private final SqlManager manager; + + ElasticPoolActivitiesImpl(SqlManager manager) { + super(manager.inner().elasticPoolActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolActivitiesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolActivity call(ElasticPoolActivityInner inner) { + return new ElasticPoolActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesInner.java new file mode 100644 index 0000000000000..aa84ba1d839a6 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivitiesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPoolActivities. + */ +public class ElasticPoolActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolActivities listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @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 List<ElasticPoolActivityInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolActivityInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolActivityInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityImpl.java new file mode 100644 index 0000000000000..13664e48ba04a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.UUID; + +class ElasticPoolActivityImpl extends WrapperImpl implements ElasticPoolActivity { + private final SqlManager manager; + ElasticPoolActivityImpl(ElasticPoolActivityInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public UUID operationId() { + return this.inner().operationId(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public Integer requestedDatabaseDtuCap() { + return this.inner().requestedDatabaseDtuCap(); + } + + @Override + public Integer requestedDatabaseDtuGuarantee() { + return this.inner().requestedDatabaseDtuGuarantee(); + } + + @Override + public Integer requestedDatabaseDtuMax() { + return this.inner().requestedDatabaseDtuMax(); + } + + @Override + public Integer requestedDatabaseDtuMin() { + return this.inner().requestedDatabaseDtuMin(); + } + + @Override + public Integer requestedDtu() { + return this.inner().requestedDtu(); + } + + @Override + public Integer requestedDtuGuarantee() { + return this.inner().requestedDtuGuarantee(); + } + + @Override + public String requestedElasticPoolName() { + return this.inner().requestedElasticPoolName(); + } + + @Override + public Long requestedStorageLimitInGB() { + return this.inner().requestedStorageLimitInGB(); + } + + @Override + public Integer requestedStorageLimitInMB() { + return this.inner().requestedStorageLimitInMB(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityInner.java new file mode 100644 index 0000000000000..bc9519601f989 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolActivityInner.java @@ -0,0 +1,348 @@ +/** + * 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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents the activity on an elastic pool. + */ +@JsonFlatten +public class ElasticPoolActivityInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /** + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The requested max DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMax", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMax; + + /** + * The requested min DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMin", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMin; + + /** + * The requested DTU for the pool if available. + */ + @JsonProperty(value = "properties.requestedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtu; + + /** + * The requested name for the elastic pool if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /** + * The requested storage limit for the pool in GB if available. + */ + @JsonProperty(value = "properties.requestedStorageLimitInGB", access = JsonProperty.Access.WRITE_ONLY) + private Long requestedStorageLimitInGB; + + /** + * The name of the elastic pool. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The requested storage limit in MB. + */ + @JsonProperty(value = "properties.requestedStorageLimitInMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedStorageLimitInMB; + + /** + * The requested per database DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuGuarantee; + + /** + * The requested per database DTU cap. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuCap", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuCap; + + /** + * The requested DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtuGuarantee; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the ElasticPoolActivityInner object itself. + */ + public ElasticPoolActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the time the operation finished (ISO8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the error code if available. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the error message if available. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the error severity if available. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the unique operation ID. + * + * @return the operationId value + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentage complete if available. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value + */ + public Integer requestedDatabaseDtuMax() { + return this.requestedDatabaseDtuMax; + } + + /** + * Get the requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value + */ + public Integer requestedDatabaseDtuMin() { + return this.requestedDatabaseDtuMin; + } + + /** + * Get the requested DTU for the pool if available. + * + * @return the requestedDtu value + */ + public Integer requestedDtu() { + return this.requestedDtu; + } + + /** + * Get the requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value + */ + public Long requestedStorageLimitInGB() { + return this.requestedStorageLimitInGB; + } + + /** + * Get the name of the elastic pool. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the name of the server the elastic pool is in. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the time the operation started (ISO8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the current state of the operation. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value + */ + public Integer requestedStorageLimitInMB() { + return this.requestedStorageLimitInMB; + } + + /** + * Get the requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value + */ + public Integer requestedDatabaseDtuGuarantee() { + return this.requestedDatabaseDtuGuarantee; + } + + /** + * Get the requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value + */ + public Integer requestedDatabaseDtuCap() { + return this.requestedDatabaseDtuCap; + } + + /** + * Get the requested DTU guarantee. + * + * @return the requestedDtuGuarantee value + */ + public Integer requestedDtuGuarantee() { + return this.requestedDtuGuarantee; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesImpl.java new file mode 100644 index 0000000000000..668dee14a1182 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolDatabaseActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolDatabaseActivity; + +class ElasticPoolDatabaseActivitiesImpl extends WrapperImpl implements ElasticPoolDatabaseActivities { + private final SqlManager manager; + + ElasticPoolDatabaseActivitiesImpl(SqlManager manager) { + super(manager.inner().elasticPoolDatabaseActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolDatabaseActivitiesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolDatabaseActivity call(ElasticPoolDatabaseActivityInner inner) { + return new ElasticPoolDatabaseActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesInner.java new file mode 100644 index 0000000000000..17b856353c825 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivitiesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPoolDatabaseActivities. + */ +public class ElasticPoolDatabaseActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolDatabaseActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolDatabaseActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolDatabaseActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolDatabaseActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolDatabaseActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolDatabaseActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolDatabaseActivities listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns activity on databases inside of 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. + * @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 List<ElasticPoolDatabaseActivityInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns activity on databases inside of 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. + * @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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns activity on databases inside of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns activity on databases inside of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityImpl.java new file mode 100644 index 0000000000000..dbe6ee8fd09f8 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolDatabaseActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.UUID; + +class ElasticPoolDatabaseActivityImpl extends WrapperImpl implements ElasticPoolDatabaseActivity { + private final SqlManager manager; + ElasticPoolDatabaseActivityImpl(ElasticPoolDatabaseActivityInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String currentElasticPoolName() { + return this.inner().currentElasticPoolName(); + } + + @Override + public String currentServiceObjective() { + return this.inner().currentServiceObjective(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public UUID operationId() { + return this.inner().operationId(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String requestedElasticPoolName() { + return this.inner().requestedElasticPoolName(); + } + + @Override + public String requestedServiceObjective() { + return this.inner().requestedServiceObjective(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityInner.java new file mode 100644 index 0000000000000..4d4aacb74d9f3 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolDatabaseActivityInner.java @@ -0,0 +1,273 @@ +/** + * 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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents the activity on an elastic pool. + */ +@JsonFlatten +public class ElasticPoolDatabaseActivityInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The database name. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /** + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The name for the elastic pool the database is moving into if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /** + * The name of the current elastic pool the database is in if available. + */ + @JsonProperty(value = "properties.currentElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String currentElasticPoolName; + + /** + * The name of the current service objective if available. + */ + @JsonProperty(value = "properties.currentServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjective; + + /** + * The name of the requested service objective if available. + */ + @JsonProperty(value = "properties.requestedServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjective; + + /** + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the ElasticPoolDatabaseActivityInner object itself. + */ + public ElasticPoolDatabaseActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the time the operation finished (ISO8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the error code if available. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the error message if available. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the error severity if available. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the unique operation ID. + * + * @return the operationId value + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentage complete if available. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the name for the elastic pool the database is moving into if available. + * + * @return the requestedElasticPoolName value + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the name of the current elastic pool the database is in if available. + * + * @return the currentElasticPoolName value + */ + public String currentElasticPoolName() { + return this.currentElasticPoolName; + } + + /** + * Get the name of the current service objective if available. + * + * @return the currentServiceObjective value + */ + public String currentServiceObjective() { + return this.currentServiceObjective; + } + + /** + * Get the name of the requested service objective if available. + * + * @return the requestedServiceObjective value + */ + public String requestedServiceObjective() { + return this.requestedServiceObjective; + } + + /** + * Get the name of the server the elastic pool is in. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the time the operation started (ISO8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the current state of the operation. + * + * @return the state value + */ + public String state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricDefinitionImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricDefinitionImpl.java new file mode 100644 index 0000000000000..5fe14c7647905 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricDefinitionImpl.java @@ -0,0 +1,60 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolServerMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.MetricAvailability; +import com.microsoft.azure.management.sql.v3_2014_04.MetricName; +import com.microsoft.azure.management.sql.v3_2014_04.PrimaryAggregationType; +import com.microsoft.azure.management.sql.v3_2014_04.UnitDefinitionType; + +class ElasticPoolServerMetricDefinitionImpl extends WrapperImpl implements ElasticPoolServerMetricDefinition { + private final SqlManager manager; + + ElasticPoolServerMetricDefinitionImpl(MetricDefinitionInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public PrimaryAggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceUri() { + return this.inner().resourceUri(); + } + + @Override + public UnitDefinitionType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricImpl.java new file mode 100644 index 0000000000000..9848d7bd96ace --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolServerMetricImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolServerMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.MetricValue; +import com.microsoft.azure.management.sql.v3_2014_04.MetricName; +import com.microsoft.azure.management.sql.v3_2014_04.UnitType; + +class ElasticPoolServerMetricImpl extends WrapperImpl implements ElasticPoolServerMetric { + private final SqlManager manager; + + ElasticPoolServerMetricImpl(MetricInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..672951519027d --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPools; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolServerMetric; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolServerMetricDefinition; + +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; + } + + private ElasticPoolServerMetricImpl wrapElasticPoolServerMetricModel(MetricInner inner) { + return new ElasticPoolServerMetricImpl(inner, manager()); + } + + private ElasticPoolServerMetricDefinitionImpl wrapElasticPoolServerMetricDefinitionModel(MetricDefinitionInner inner) { + return new ElasticPoolServerMetricDefinitionImpl(inner, manager()); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + ElasticPoolsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, serverName, elasticPoolName, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolServerMetric call(MetricInner inner) { + return wrapElasticPoolServerMetricModel(inner); + } + }); + } + + @Override + public Observable listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.listMetricDefinitionsAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolServerMetricDefinition call(MetricDefinitionInner inner) { + return wrapElasticPoolServerMetricDefinitionModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsInner.java new file mode 100644 index 0000000000000..bd56ed497dab6 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ElasticPoolsInner.java @@ -0,0 +1,268 @@ +/** + * 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.v3_2014_04.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 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.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.v3_2014_04.ElasticPools listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.v3_2014_04.ElasticPools listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, filter).toBlocking().single().body(); + } + + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @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> listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, filter), serviceCallback); + } + + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns elastic pool 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 serverName The name of the server. + * @param elasticPoolName The name of the elastic pool. + * @param filter An OData filter expression that describes a subset of metrics to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, String filter) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(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); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @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 List<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String serverName, String elasticPoolName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns elastic pool metric definitions. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricDefinitionsDelegate(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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..1a8c672b956d8 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleImpl.java @@ -0,0 +1,126 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.FirewallRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class FirewallRuleImpl extends CreatableUpdatableImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String firewallRuleName; + + FirewallRuleImpl(String name, SqlManager manager) { + super(name, new FirewallRuleInner()); + this.manager = manager; + // Set resource name + this.firewallRuleName = name; + // + } + + FirewallRuleImpl(FirewallRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.firewallRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.firewallRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "firewallRules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.getAsync(this.resourceGroupName, this.serverName, this.firewallRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String endIpAddress() { + return this.inner().endIpAddress(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String startIpAddress() { + return this.inner().startIpAddress(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.inner().withEndIpAddress(endIpAddress); + return this; + } + + @Override + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.inner().withStartIpAddress(startIpAddress); + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleInner.java new file mode 100644 index 0000000000000..c314b980eae21 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRuleInner.java @@ -0,0 +1,105 @@ +/** + * 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.v3_2014_04.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a server firewall rule. + */ +@JsonFlatten +public class FirewallRuleInner extends ProxyResource { + /** + * Kind of server that contains this firewall rule. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The start IP address of the firewall rule. Must be IPv4 format. Use + * value '0.0.0.0' to represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.startIpAddress", required = true) + private String startIpAddress; + + /** + * The end IP address of the firewall rule. Must be IPv4 format. Must be + * greater than or equal to startIpAddress. Use value '0.0.0.0' to + * represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.endIpAddress", required = true) + private String endIpAddress; + + /** + * Get kind of server that contains this firewall rule. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get location of the server that contains this firewall rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the startIpAddress value + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param startIpAddress the startIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the endIpAddress value + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param endIpAddress the endIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..b7a90ba7adc4e --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.FirewallRules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.FirewallRule; + +class FirewallRulesImpl extends WrapperImpl implements FirewallRules { + private final SqlManager manager; + + FirewallRulesImpl(SqlManager manager) { + super(manager.inner().firewallRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public FirewallRuleImpl define(String name) { + return wrapModel(name); + } + + private FirewallRuleImpl wrapModel(FirewallRuleInner inner) { + return new FirewallRuleImpl(inner, manager()); + } + + private FirewallRuleImpl wrapModel(String name) { + return new FirewallRuleImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + FirewallRulesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, firewallRuleName) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, firewallRuleName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesInner.java new file mode 100644 index 0000000000000..d94154e881948 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/FirewallRulesInner.java @@ -0,0 +1,456 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in FirewallRules. + */ +public class FirewallRulesInner { + /** The Retrofit service to perform REST calls. */ + private FirewallRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(FirewallRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallRules to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.FirewallRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Body FirewallRuleInner 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.v3_2014_04.FirewallRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @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.v3_2014_04.FirewallRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @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.v3_2014_04.FirewallRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules") + 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); + + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 firewallRuleName, FirewallRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, this.client.apiVersion(), parameters, 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 a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, 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); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesImpl.java new file mode 100644 index 0000000000000..cb81dbbacf77b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicies; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicy; + +class GeoBackupPoliciesImpl extends WrapperImpl implements GeoBackupPolicies { + private final SqlManager manager; + + GeoBackupPoliciesImpl(SqlManager manager) { + super(manager.inner().geoBackupPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public GeoBackupPolicyImpl define(String name) { + return wrapModel(name); + } + + private GeoBackupPolicyImpl wrapModel(GeoBackupPolicyInner inner) { + return new GeoBackupPolicyImpl(inner, manager()); + } + + private GeoBackupPolicyImpl wrapModel(String name) { + return new GeoBackupPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + GeoBackupPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public GeoBackupPolicy call(GeoBackupPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + GeoBackupPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public GeoBackupPolicy call(GeoBackupPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesInner.java new file mode 100644 index 0000000000000..f942eb4b589f7 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPoliciesInner.java @@ -0,0 +1,368 @@ +/** + * 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.v3_2014_04.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicyState; +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.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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in GeoBackupPolicies. + */ +public class GeoBackupPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private GeoBackupPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of GeoBackupPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GeoBackupPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(GeoBackupPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for GeoBackupPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface GeoBackupPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("geoBackupPolicyName") String geoBackupPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body GeoBackupPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("geoBackupPolicyName") String geoBackupPolicyName, @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.v3_2014_04.GeoBackupPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @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 GeoBackupPolicyInner object if successful. + */ + public GeoBackupPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state).toBlocking().single().body(); + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @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, GeoBackupPolicyState state, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state), serviceCallback); + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state).map(new Func1, GeoBackupPolicyInner>() { + @Override + public GeoBackupPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database geo backup 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. + * @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 (state == null) { + throw new IllegalArgumentException("Parameter state is required and cannot be null."); + } + final String geoBackupPolicyName = "Default"; + GeoBackupPolicyInner parameters = new GeoBackupPolicyInner(); + parameters.withState(state); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 geo backup 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. + * @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 GeoBackupPolicyInner object if successful. + */ + public GeoBackupPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a geo backup 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. + * @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 geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, GeoBackupPolicyInner>() { + @Override + public GeoBackupPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GeoBackupPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 geoBackupPolicyName = "Default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, geoBackupPolicyName, 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); + } + + /** + * Returns a list of geo backup 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. + * @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 List<GeoBackupPolicyInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a list of geo backup 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a list of geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<GeoBackupPolicyInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of geo backup 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<GeoBackupPolicyInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyImpl.java new file mode 100644 index 0000000000000..cee9a44447161 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicyState; + +class GeoBackupPolicyImpl extends CreatableUpdatableImpl implements GeoBackupPolicy, GeoBackupPolicy.Definition, GeoBackupPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private GeoBackupPolicyState cstate; + private GeoBackupPolicyState ustate; + + GeoBackupPolicyImpl(String name, SqlManager manager) { + super(name, new GeoBackupPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + GeoBackupPolicyImpl(GeoBackupPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + GeoBackupPoliciesInner client = this.manager().inner().geoBackupPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.cstate) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + GeoBackupPoliciesInner client = this.manager().inner().geoBackupPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ustate) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + GeoBackupPoliciesInner client = this.manager().inner().geoBackupPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public GeoBackupPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageType() { + return this.inner().storageType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public GeoBackupPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public GeoBackupPolicyImpl withState(GeoBackupPolicyState state) { + if (isInCreateMode()) { + this.cstate = state; + } else { + this.ustate = state; + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyInner.java new file mode 100644 index 0000000000000..a1ef2006dde02 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/GeoBackupPolicyInner.java @@ -0,0 +1,94 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database geo backup policy. + */ +@JsonFlatten +public class GeoBackupPolicyInner extends ProxyResource { + /** + * The state of the geo backup policy. Possible values include: 'Disabled', + * 'Enabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private GeoBackupPolicyState state; + + /** + * The storage type of the geo backup policy. + */ + @JsonProperty(value = "properties.storageType", access = JsonProperty.Access.WRITE_ONLY) + private String storageType; + + /** + * Kind of geo backup policy. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Backup policy location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the state of the geo backup policy. Possible values include: 'Disabled', 'Enabled'. + * + * @return the state value + */ + public GeoBackupPolicyState state() { + return this.state; + } + + /** + * Set the state of the geo backup policy. Possible values include: 'Disabled', 'Enabled'. + * + * @param state the state value to set + * @return the GeoBackupPolicyInner object itself. + */ + public GeoBackupPolicyInner withState(GeoBackupPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storage type of the geo backup policy. + * + * @return the storageType value + */ + public String storageType() { + return this.storageType; + } + + /** + * Get kind of geo backup policy. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get backup policy location. + * + * @return the location value + */ + public String location() { + return this.location; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/IdParsingUtils.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..740164bf2b2f2 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v3_2014_04.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseImpl.java new file mode 100644 index 0000000000000..6c5a842a56c52 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseImpl.java @@ -0,0 +1,219 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ImportExportResponse; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.ImportExtensionRequest; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2014_04.AuthenticationType; +import com.microsoft.azure.management.sql.v3_2014_04.StorageKeyType; +import rx.functions.Func1; + +class ImportExportResponseImpl extends CreatableUpdatableImpl implements ImportExportResponse, ImportExportResponse.Definition, ImportExportResponse.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private ImportExtensionRequest createOrUpdateParameter; + + ImportExportResponseImpl(String name, SqlManager manager) { + super(name, new ImportExportResponseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + ImportExportResponseImpl(ImportExportResponseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createImportOperationAsync(this.resourceGroupName, this.serverName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public ImportExportResponseInner call(ImportExportResponseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createImportOperationAsync(this.resourceGroupName, this.serverName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public ImportExportResponseInner call(ImportExportResponseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + @Override + public String blobUri() { + return this.inner().blobUri(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String queuedTime() { + return this.inner().queuedTime(); + } + + @Override + public UUID requestId() { + return this.inner().requestId(); + } + + @Override + public String requestType() { + return this.inner().requestType(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ImportExportResponseImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public ImportExportResponseImpl withAdministratorLogin(String administratorLogin) { + this.createOrUpdateParameter.withAdministratorLogin(administratorLogin); + return this; + } + + @Override + public ImportExportResponseImpl withAdministratorLoginPassword(String administratorLoginPassword) { + this.createOrUpdateParameter.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + @Override + public ImportExportResponseImpl withOperationMode(String operationMode) { + this.createOrUpdateParameter.withOperationMode(operationMode); + return this; + } + + @Override + public ImportExportResponseImpl withStorageKey(String storageKey) { + this.createOrUpdateParameter.withStorageKey(storageKey); + return this; + } + + @Override + public ImportExportResponseImpl withStorageKeyType(StorageKeyType storageKeyType) { + this.createOrUpdateParameter.withStorageKeyType(storageKeyType); + return this; + } + + @Override + public ImportExportResponseImpl withStorageUri(String storageUri) { + this.createOrUpdateParameter.withStorageUri(storageUri); + return this; + } + + @Override + public ImportExportResponseImpl withAuthenticationType(AuthenticationType authenticationType) { + this.createOrUpdateParameter.withAuthenticationType(authenticationType); + return this; + } + + @Override + public ImportExportResponseImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + + @Override + public ImportExportResponseImpl withType(String type) { + this.createOrUpdateParameter.withType(type); + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseInner.java new file mode 100644 index 0000000000000..ee88cb3e81952 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ImportExportResponseInner.java @@ -0,0 +1,156 @@ +/** + * 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.v3_2014_04.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Response for Import/Export Get operation. + */ +@JsonFlatten +public class ImportExportResponseInner extends ProxyResource { + /** + * The request type of the operation. + */ + @JsonProperty(value = "properties.requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /** + * The request type of the operation. + */ + @JsonProperty(value = "properties.requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /** + * The name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The status message returned from the server. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The operation status last modified time. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /** + * The operation queued time. + */ + @JsonProperty(value = "properties.queuedTime", access = JsonProperty.Access.WRITE_ONLY) + private String queuedTime; + + /** + * The blob uri. + */ + @JsonProperty(value = "properties.blobUri", access = JsonProperty.Access.WRITE_ONLY) + private String blobUri; + + /** + * The error message returned from the server. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * Get the request type of the operation. + * + * @return the requestType value + */ + public String requestType() { + return this.requestType; + } + + /** + * Get the request type of the operation. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the name of the database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the status message returned from the server. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the operation status last modified time. + * + * @return the lastModifiedTime value + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the operation queued time. + * + * @return the queuedTime value + */ + public String queuedTime() { + return this.queuedTime; + } + + /** + * Get the blob uri. + * + * @return the blobUri value + */ + public String blobUri() { + return this.blobUri; + } + + /** + * Get the error message returned from the server. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricDefinitionInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricDefinitionInner.java new file mode 100644 index 0000000000000..c341a48dc0788 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricDefinitionInner.java @@ -0,0 +1,100 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.MetricName; +import com.microsoft.azure.management.sql.v3_2014_04.PrimaryAggregationType; +import com.microsoft.azure.management.sql.v3_2014_04.UnitDefinitionType; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.MetricAvailability; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A database metric definition. + */ +public class MetricDefinitionInner { + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The primary aggregation type defining how metric values are displayed. + * Possible values include: 'None', 'Average', 'Count', 'Minimum', + * 'Maximum', 'Total'. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /** + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitDefinitionType unit; + + /** + * The list of database metric availabities for the metric. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total'. + * + * @return the primaryAggregationType value + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the resource uri of the database. + * + * @return the resourceUri value + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond'. + * + * @return the unit value + */ + public UnitDefinitionType unit() { + return this.unit; + } + + /** + * Get the list of database metric availabities for the metric. + * + * @return the metricAvailabilities value + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricInner.java new file mode 100644 index 0000000000000..8fdfe61768656 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/MetricInner.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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2014_04.UnitType; +import com.microsoft.azure.management.sql.v3_2014_04.MetricName; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.MetricValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Database metrics. + */ +public class MetricInner { + /** + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The time step to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The unit of the metric. Possible values include: 'count', 'bytes', + * 'seconds', 'percent', 'countPerSecond', 'bytesPerSecond'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the start time for the metric (ISO-8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the end time for the metric (ISO-8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the time step to be used to summarize the metric values. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit of the metric. Possible values include: 'count', 'bytes', 'seconds', 'percent', 'countPerSecond', 'bytesPerSecond'. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metric values for the specified time window and timestep. + * + * @return the metricValues value + */ + public List metricValues() { + return this.metricValues; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/PageImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/PageImpl.java new file mode 100644 index 0000000000000..f14fd1bbfc66a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2014_04.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolImpl.java new file mode 100644 index 0000000000000..164698b1ceb84 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPool; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolEdition; +import java.util.List; +import com.microsoft.azure.Resource; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPoolMetric; +import org.joda.time.DateTime; + +class RecommendedElasticPoolImpl extends IndexableRefreshableWrapperImpl implements RecommendedElasticPool { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String recommendedElasticPoolName; + + RecommendedElasticPoolImpl(RecommendedElasticPoolInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.recommendedElasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendedElasticPools"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecommendedElasticPoolsInner client = this.manager().inner().recommendedElasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.recommendedElasticPoolName); + } + + + + @Override + public Double databaseDtuMax() { + return this.inner().databaseDtuMax(); + } + + @Override + public Double databaseDtuMin() { + return this.inner().databaseDtuMin(); + } + + @Override + public ElasticPoolEdition databaseEdition() { + return this.inner().databaseEdition(); + } + + @Override + public List databases() { + return this.inner().databases(); + } + + @Override + public Double dtu() { + return this.inner().dtu(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double maxObservedDtu() { + return this.inner().maxObservedDtu(); + } + + @Override + public Double maxObservedStorageMB() { + return this.inner().maxObservedStorageMB(); + } + + @Override + public List metrics() { + List lst = new ArrayList(); + if (this.inner().metrics() != null) { + for (RecommendedElasticPoolMetricInner inner : this.inner().metrics()) { + lst.add( new RecommendedElasticPoolMetricImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime observationPeriodEnd() { + return this.inner().observationPeriodEnd(); + } + + @Override + public DateTime observationPeriodStart() { + return this.inner().observationPeriodStart(); + } + + @Override + public Double storageMB() { + return this.inner().storageMB(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolInner.java new file mode 100644 index 0000000000000..851dc535a92d5 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolInner.java @@ -0,0 +1,235 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolEdition; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.Resource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a recommented elastic pool. + */ +@JsonFlatten +public class RecommendedElasticPoolInner extends ProxyResource { + /** + * The edition of the recommended elastic pool. The ElasticPoolEdition + * enumeration contains all the valid editions. Possible values include: + * 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.databaseEdition", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolEdition databaseEdition; + + /** + * The DTU for the recommended elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Double dtu; + + /** + * The minimum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Double databaseDtuMin; + + /** + * The maximum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Double databaseDtuMax; + + /** + * Gets storage size in megabytes. + */ + @JsonProperty(value = "properties.storageMB") + private Double storageMB; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodStart; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodEnd; + + /** + * Gets maximum observed DTU. + */ + @JsonProperty(value = "properties.maxObservedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedDtu; + + /** + * Gets maximum observed storage in megabytes. + */ + @JsonProperty(value = "properties.maxObservedStorageMB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedStorageMB; + + /** + * The list of databases in this pool. Expanded property. + */ + @JsonProperty(value = "properties.databases", access = JsonProperty.Access.WRITE_ONLY) + private List databases; + + /** + * The list of databases housed in the server. Expanded property. + */ + @JsonProperty(value = "properties.metrics", access = JsonProperty.Access.WRITE_ONLY) + private List metrics; + + /** + * Get the edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the databaseEdition value + */ + public ElasticPoolEdition databaseEdition() { + return this.databaseEdition; + } + + /** + * Get the DTU for the recommended elastic pool. + * + * @return the dtu value + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set the DTU for the recommended elastic pool. + * + * @param dtu the dtu value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the minimum DTU for the database. + * + * @return the databaseDtuMin value + */ + public Double databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the minimum DTU for the database. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMin(Double databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get the maximum DTU for the database. + * + * @return the databaseDtuMax value + */ + public Double databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the maximum DTU for the database. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMax(Double databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get gets storage size in megabytes. + * + * @return the storageMB value + */ + public Double storageMB() { + return this.storageMB; + } + + /** + * Set gets storage size in megabytes. + * + * @param storageMB the storageMB value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withStorageMB(Double storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodStart value + */ + public DateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value + */ + public DateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get gets maximum observed DTU. + * + * @return the maxObservedDtu value + */ + public Double maxObservedDtu() { + return this.maxObservedDtu; + } + + /** + * Get gets maximum observed storage in megabytes. + * + * @return the maxObservedStorageMB value + */ + public Double maxObservedStorageMB() { + return this.maxObservedStorageMB; + } + + /** + * Get the list of databases in this pool. Expanded property. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Get the list of databases housed in the server. Expanded property. + * + * @return the metrics value + */ + public List metrics() { + return this.metrics; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricImpl.java new file mode 100644 index 0000000000000..0b50bb47ce847 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricImpl.java @@ -0,0 +1,46 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPoolMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class RecommendedElasticPoolMetricImpl extends WrapperImpl implements RecommendedElasticPoolMetric { + private final SqlManager manager; + + RecommendedElasticPoolMetricImpl(RecommendedElasticPoolMetricInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime dateTimeProperty() { + return this.inner().dateTimeProperty(); + } + + @Override + public Double dtu() { + return this.inner().dtu(); + } + + @Override + public Double sizeGB() { + return this.inner().sizeGB(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricInner.java new file mode 100644 index 0000000000000..0a9f0b47eb363 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolMetricInner.java @@ -0,0 +1,97 @@ +/** + * 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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents recommended elastic pool metric. + */ +public class RecommendedElasticPoolMetricInner { + /** + * The time of metric (ISO8601 format). + */ + @JsonProperty(value = "dateTime") + private DateTime dateTimeProperty; + + /** + * Gets or sets the DTUs (Database Transaction Units). See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + */ + @JsonProperty(value = "dtu") + private Double dtu; + + /** + * Gets or sets size in gigabytes. + */ + @JsonProperty(value = "sizeGB") + private Double sizeGB; + + /** + * Get the time of metric (ISO8601 format). + * + * @return the dateTimeProperty value + */ + public DateTime dateTimeProperty() { + return this.dateTimeProperty; + } + + /** + * Set the time of metric (ISO8601 format). + * + * @param dateTimeProperty the dateTimeProperty value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDateTimeProperty(DateTime dateTimeProperty) { + this.dateTimeProperty = dateTimeProperty; + return this; + } + + /** + * Get gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @return the dtu value + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @param dtu the dtu value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get gets or sets size in gigabytes. + * + * @return the sizeGB value + */ + public Double sizeGB() { + return this.sizeGB; + } + + /** + * Set gets or sets size in gigabytes. + * + * @param sizeGB the sizeGB value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withSizeGB(Double sizeGB) { + this.sizeGB = sizeGB; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsImpl.java new file mode 100644 index 0000000000000..1bac83c70b03b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPools; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPool; +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPoolMetric; + +class RecommendedElasticPoolsImpl extends WrapperImpl implements RecommendedElasticPools { + private final SqlManager manager; + + RecommendedElasticPoolsImpl(SqlManager manager) { + super(manager.inner().recommendedElasticPools()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RecommendedElasticPoolImpl wrapModel(RecommendedElasticPoolInner inner) { + return new RecommendedElasticPoolImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecommendedElasticPool call(RecommendedElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .map(new Func1() { + @Override + public RecommendedElasticPool call(RecommendedElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + private RecommendedElasticPoolMetricImpl wrapRecommendedElasticPoolMetricModel(RecommendedElasticPoolMetricInner inner) { + return new RecommendedElasticPoolMetricImpl(inner, manager()); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecommendedElasticPoolMetric call(RecommendedElasticPoolMetricInner inner) { + return wrapRecommendedElasticPoolMetricModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsInner.java new file mode 100644 index 0000000000000..ac131458e4a8c --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecommendedElasticPoolsInner.java @@ -0,0 +1,351 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RecommendedElasticPools. + */ +public class RecommendedElasticPoolsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendedElasticPoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedElasticPoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendedElasticPoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecommendedElasticPoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecommendedElasticPools to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendedElasticPoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @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.v3_2014_04.RecommendedElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools") + 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.v3_2014_04.RecommendedElasticPools listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic 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 RecommendedElasticPoolInner object if successful. + */ + public RecommendedElasticPoolInner get(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic 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 getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1, RecommendedElasticPoolInner>() { + @Override + public RecommendedElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a recommented 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + 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 (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, 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); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic 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 List<RecommendedElasticPoolMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic 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> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedElasticPoolMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns recommented elastic pool 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 serverName The name of the server. + * @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedElasticPoolMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + 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 (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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.listMetrics(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseImpl.java new file mode 100644 index 0000000000000..58082fd6c53f1 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.RecoverableDatabase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class RecoverableDatabaseImpl extends IndexableRefreshableWrapperImpl implements RecoverableDatabase { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + RecoverableDatabaseImpl(RecoverableDatabaseInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "recoverableDatabases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecoverableDatabasesInner client = this.manager().inner().recoverableDatabases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + + + @Override + public String edition() { + return this.inner().edition(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastAvailableBackupDate() { + return this.inner().lastAvailableBackupDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceLevelObjective() { + return this.inner().serviceLevelObjective(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseInner.java new file mode 100644 index 0000000000000..24e4fb2c5829f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabaseInner.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A recoverable database. + */ +@JsonFlatten +public class RecoverableDatabaseInner extends ProxyResource { + /** + * The edition of the database. + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /** + * The service level objective name of the database. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /** + * The elastic pool name of the database. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The last available backup date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.lastAvailableBackupDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastAvailableBackupDate; + + /** + * Get the edition of the database. + * + * @return the edition value + */ + public String edition() { + return this.edition; + } + + /** + * Get the service level objective name of the database. + * + * @return the serviceLevelObjective value + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the elastic pool name of the database. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value + */ + public DateTime lastAvailableBackupDate() { + return this.lastAvailableBackupDate; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesImpl.java new file mode 100644 index 0000000000000..0e637801ff27a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.RecoverableDatabases; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.RecoverableDatabase; + +class RecoverableDatabasesImpl extends WrapperImpl implements RecoverableDatabases { + private final SqlManager manager; + + RecoverableDatabasesImpl(SqlManager manager) { + super(manager.inner().recoverableDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RecoverableDatabaseImpl wrapModel(RecoverableDatabaseInner inner) { + return new RecoverableDatabaseImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + RecoverableDatabasesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecoverableDatabase call(RecoverableDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + RecoverableDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public RecoverableDatabase call(RecoverableDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesInner.java new file mode 100644 index 0000000000000..c6e919167c8e2 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RecoverableDatabasesInner.java @@ -0,0 +1,249 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RecoverableDatabases. + */ +public class RecoverableDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private RecoverableDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecoverableDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecoverableDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecoverableDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface RecoverableDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.RecoverableDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v3_2014_04.RecoverableDatabases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases") + 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); + + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @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 RecoverableDatabaseInner object if successful. + */ + public RecoverableDatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @param databaseName The name of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecoverableDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, RecoverableDatabaseInner>() { + @Override + public RecoverableDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a recoverable database, which is a resource representing a database's geo 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 serverName The name of the server. + * @param databaseName The name of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecoverableDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, 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 recoverable 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 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 List<RecoverableDatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of recoverable 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 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of recoverable 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecoverableDatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of recoverable 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecoverableDatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkImpl.java new file mode 100644 index 0000000000000..d9319c24a7021 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationLink; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationRole; +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationState; +import org.joda.time.DateTime; + +class ReplicationLinkImpl extends IndexableRefreshableWrapperImpl implements ReplicationLink { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String linkId; + + ReplicationLinkImpl(ReplicationLinkInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.linkId = IdParsingUtils.getValueFromIdByName(inner.id(), "replicationLinks"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ReplicationLinksInner client = this.manager().inner().replicationLinks(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.linkId); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isTerminationAllowed() { + return this.inner().isTerminationAllowed(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerDatabase() { + return this.inner().partnerDatabase(); + } + + @Override + public String partnerLocation() { + return this.inner().partnerLocation(); + } + + @Override + public ReplicationRole partnerRole() { + return this.inner().partnerRole(); + } + + @Override + public String partnerServer() { + return this.inner().partnerServer(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String replicationMode() { + return this.inner().replicationMode(); + } + + @Override + public ReplicationState replicationState() { + return this.inner().replicationState(); + } + + @Override + public ReplicationRole role() { + return this.inner().role(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkInner.java new file mode 100644 index 0000000000000..89ba51ae544d6 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinkInner.java @@ -0,0 +1,194 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationRole; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database replication link. + */ +@JsonFlatten +public class ReplicationLinkInner extends ProxyResource { + /** + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Legacy value indicating whether termination is allowed. Currently + * always returns true. + */ + @JsonProperty(value = "properties.isTerminationAllowed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTerminationAllowed; + + /** + * Replication mode of this replication link. + */ + @JsonProperty(value = "properties.replicationMode", access = JsonProperty.Access.WRITE_ONLY) + private String replicationMode; + + /** + * The name of the server hosting the partner database. + */ + @JsonProperty(value = "properties.partnerServer", access = JsonProperty.Access.WRITE_ONLY) + private String partnerServer; + + /** + * The name of the partner database. + */ + @JsonProperty(value = "properties.partnerDatabase", access = JsonProperty.Access.WRITE_ONLY) + private String partnerDatabase; + + /** + * The Azure Region of the partner database. + */ + @JsonProperty(value = "properties.partnerLocation", access = JsonProperty.Access.WRITE_ONLY) + private String partnerLocation; + + /** + * The role of the database in the replication link. Possible values + * include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', + * 'Copy'. + */ + @JsonProperty(value = "properties.role", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole role; + + /** + * The role of the partner database in the replication link. Possible + * values include: 'Primary', 'Secondary', 'NonReadableSecondary', + * 'Source', 'Copy'. + */ + @JsonProperty(value = "properties.partnerRole", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole partnerRole; + + /** + * The start time for the replication link. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The percentage of seeding complete for the replication link. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The replication state for the replication link. Possible values include: + * 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED'. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationState replicationState; + + /** + * Get location of the server that contains this firewall rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get legacy value indicating whether termination is allowed. Currently always returns true. + * + * @return the isTerminationAllowed value + */ + public Boolean isTerminationAllowed() { + return this.isTerminationAllowed; + } + + /** + * Get replication mode of this replication link. + * + * @return the replicationMode value + */ + public String replicationMode() { + return this.replicationMode; + } + + /** + * Get the name of the server hosting the partner database. + * + * @return the partnerServer value + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Get the name of the partner database. + * + * @return the partnerDatabase value + */ + public String partnerDatabase() { + return this.partnerDatabase; + } + + /** + * Get the Azure Region of the partner database. + * + * @return the partnerLocation value + */ + public String partnerLocation() { + return this.partnerLocation; + } + + /** + * Get the role of the database in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy'. + * + * @return the role value + */ + public ReplicationRole role() { + return this.role; + } + + /** + * Get the role of the partner database in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy'. + * + * @return the partnerRole value + */ + public ReplicationRole partnerRole() { + return this.partnerRole; + } + + /** + * Get the start time for the replication link. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the percentage of seeding complete for the replication link. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED'. + * + * @return the replicationState value + */ + public ReplicationState replicationState() { + return this.replicationState; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksImpl.java new file mode 100644 index 0000000000000..7125fead8f26a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationLinks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationLink; + +class ReplicationLinksImpl extends WrapperImpl implements ReplicationLinks { + private final SqlManager manager; + + ReplicationLinksImpl(SqlManager manager) { + super(manager.inner().replicationLinks()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ReplicationLinkImpl wrapModel(ReplicationLinkInner inner) { + return new ReplicationLinkImpl(inner, manager()); + } + + @Override + public Completable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + + @Override + public Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.failoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + ReplicationLinksInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReplicationLink call(ReplicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, linkId) + .map(new Func1() { + @Override + public ReplicationLink call(ReplicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksInner.java new file mode 100644 index 0000000000000..8fbadb65d1e74 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ReplicationLinksInner.java @@ -0,0 +1,749 @@ +/** + * 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.v3_2014_04.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 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.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 ReplicationLinks. + */ +public class ReplicationLinksInner { + /** The Retrofit service to perform REST calls. */ + private ReplicationLinksService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ReplicationLinksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReplicationLinksInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ReplicationLinksService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReplicationLinks to be + * used by Retrofit to perform actually REST calls. + */ + interface ReplicationLinksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ReplicationLinks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v3_2014_04.ReplicationLinks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v3_2014_04.ReplicationLinks failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + Observable> failover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v3_2014_04.ReplicationLinks beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + Observable> beginFailover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v3_2014_04.ReplicationLinks failoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + Observable> failoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v3_2014_04.ReplicationLinks beginFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + Observable> beginFailoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v3_2014_04.ReplicationLinks listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link 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 serverName, String databaseName, String linkId) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link 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 serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID 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 ReplicationLinkInner object if successful. + */ + public ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID 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 getAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationLinkInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, ReplicationLinkInner>() { + @Override + public ReplicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationLinkInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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 which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId) { + failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId) { + beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.failoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.beginFailoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverAllowDataLossDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @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 List<ReplicationLinkInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReplicationLinkInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReplicationLinkInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseImpl.java new file mode 100644 index 0000000000000..eefc1df35bc62 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseImpl.java @@ -0,0 +1,103 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.RestorableDroppedDatabase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class RestorableDroppedDatabaseImpl extends IndexableRefreshableWrapperImpl implements RestorableDroppedDatabase { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String restorableDroppededDatabaseId; + + RestorableDroppedDatabaseImpl(RestorableDroppedDatabaseInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.restorableDroppededDatabaseId = IdParsingUtils.getValueFromIdByName(inner.id(), "restorableDroppedDatabases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RestorableDroppedDatabasesInner client = this.manager().inner().restorableDroppedDatabases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.restorableDroppededDatabaseId); + } + + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public DateTime deletionDate() { + return this.inner().deletionDate(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String edition() { + return this.inner().edition(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceLevelObjective() { + return this.inner().serviceLevelObjective(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseInner.java new file mode 100644 index 0000000000000..515595a7b3f17 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabaseInner.java @@ -0,0 +1,156 @@ +/** + * 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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A restorable dropped database. + */ +@JsonFlatten +public class RestorableDroppedDatabaseInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The edition of the database. + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /** + * The max size in bytes of the database. + */ + @JsonProperty(value = "properties.maxSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private String maxSizeBytes; + + /** + * The service level objective name of the database. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /** + * The elastic pool name of the database. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deletionDate; + + /** + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the name of the database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the edition of the database. + * + * @return the edition value + */ + public String edition() { + return this.edition; + } + + /** + * Get the max size in bytes of the database. + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Get the service level objective name of the database. + * + * @return the serviceLevelObjective value + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the elastic pool name of the database. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletion date of the database (ISO8601 format). + * + * @return the deletionDate value + */ + public DateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesImpl.java new file mode 100644 index 0000000000000..2bfa5cc9d0b25 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.RestorableDroppedDatabases; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.RestorableDroppedDatabase; + +class RestorableDroppedDatabasesImpl extends WrapperImpl implements RestorableDroppedDatabases { + private final SqlManager manager; + + RestorableDroppedDatabasesImpl(SqlManager manager) { + super(manager.inner().restorableDroppedDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RestorableDroppedDatabaseImpl wrapModel(RestorableDroppedDatabaseInner inner) { + return new RestorableDroppedDatabaseImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + RestorableDroppedDatabasesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RestorableDroppedDatabase call(RestorableDroppedDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + RestorableDroppedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, restorableDroppededDatabaseId) + .map(new Func1() { + @Override + public RestorableDroppedDatabase call(RestorableDroppedDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesInner.java new file mode 100644 index 0000000000000..ad712254df506 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/RestorableDroppedDatabasesInner.java @@ -0,0 +1,249 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RestorableDroppedDatabases. + */ +public class RestorableDroppedDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private RestorableDroppedDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RestorableDroppedDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RestorableDroppedDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RestorableDroppedDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface RestorableDroppedDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.RestorableDroppedDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("restorableDroppededDatabaseId") String restorableDroppededDatabaseId, @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.v3_2014_04.RestorableDroppedDatabases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases") + 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); + + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @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 RestorableDroppedDatabaseInner object if successful. + */ + public RestorableDroppedDatabaseInner get(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).toBlocking().single().body(); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @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 restorableDroppededDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId), serviceCallback); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).map(new Func1, RestorableDroppedDatabaseInner>() { + @Override + public RestorableDroppedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deleted database that can be restored. + * + * @param resourceGroupName The 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 restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { + 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 (restorableDroppededDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppededDatabaseId 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(this.client.subscriptionId(), resourceGroupName, serverName, restorableDroppededDatabaseId, 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 deleted databases that can be restored. + * + * @param resourceGroupName The 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 List<RestorableDroppedDatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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 List<RestorableDroppedDatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of deleted databases that can be restored. + * + * @param resourceGroupName The 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 List<RestorableDroppedDatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorImpl.java new file mode 100644 index 0000000000000..f8f040e683d6d --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.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(); + // resource ancestor names + 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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorInner.java new file mode 100644 index 0000000000000..eec92f607ce66 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorInner.java @@ -0,0 +1,135 @@ +/** + * 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.v3_2014_04.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An server Active Directory Administrator. + */ +@JsonFlatten +public class ServerAzureADAdministratorInner extends ProxyResource { + /** + * The type of administrator. + */ + @JsonProperty(value = "properties.administratorType", required = true) + private String administratorType; + + /** + * The server administrator login value. + */ + @JsonProperty(value = "properties.login", required = true) + private String login; + + /** + * The server administrator Sid (Secure ID). + */ + @JsonProperty(value = "properties.sid", required = true) + private UUID sid; + + /** + * The server Active Directory Administrator tenant id. + */ + @JsonProperty(value = "properties.tenantId", required = true) + private UUID tenantId; + + /** + * Creates an instance of ServerAzureADAdministratorInner class. + * @param login the server administrator login value. + * @param sid the server administrator Sid (Secure ID). + * @param tenantId the server Active Directory Administrator tenant id. + */ + public ServerAzureADAdministratorInner() { + administratorType = "ActiveDirectory"; + } + + /** + * Get the type of administrator. + * + * @return the administratorType value + */ + public String administratorType() { + return this.administratorType; + } + + /** + * Set the type of administrator. + * + * @param administratorType the administratorType value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withAdministratorType(String administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the server administrator login value. + * + * @return the login value + */ + public String login() { + return this.login; + } + + /** + * Set the server administrator login value. + * + * @param login the login value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the server administrator Sid (Secure ID). + * + * @return the sid value + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the server administrator Sid (Secure ID). + * + * @param sid the sid value to set + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the server Active Directory Administrator tenant id. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the server Active Directory Administrator tenant id. + * + * @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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsImpl.java new file mode 100644 index 0000000000000..f3d02029cc3b3 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ServerAzureADAdministrators; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ServerAzureADAdministrator; + +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 define(String name) { + return wrapModel(name); + } + + private ServerAzureADAdministratorImpl wrapModel(ServerAzureADAdministratorInner inner) { + return new ServerAzureADAdministratorImpl(inner, manager()); + } + + private ServerAzureADAdministratorImpl wrapModel(String name) { + return new ServerAzureADAdministratorImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServerAzureADAdministrator call(ServerAzureADAdministratorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerAzureADAdministrator call(ServerAzureADAdministratorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName) { + ServerAzureADAdministratorsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsInner.java new file mode 100644 index 0000000000000..325b152c0358e --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerAzureADAdministratorsInner.java @@ -0,0 +1,598 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +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 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.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.v3_2014_04.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 properties, @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.v3_2014_04.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 properties, @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.v3_2014_04.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.v3_2014_04.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.v3_2014_04.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.v3_2014_04.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); + + } + + /** + * 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 properties 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 properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties), 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 properties 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 properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties) { + 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 (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String administratorName = "activeDirectory"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), properties, 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 properties 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 properties) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties), 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 properties 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 properties) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).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 properties 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 properties) { + 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 (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String administratorName = "activeDirectory"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, administratorName, this.client.apiVersion(), properties, 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 + * @return the ServerAzureADAdministratorInner object if successful. + */ + public ServerAzureADAdministratorInner delete(String resourceGroupName, String serverName) { + return 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, ServerAzureADAdministratorInner>() { + @Override + public ServerAzureADAdministratorInner 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 + * @return the ServerAzureADAdministratorInner object if successful. + */ + public ServerAzureADAdministratorInner beginDelete(String resourceGroupName, String serverName) { + return 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 observable to the ServerAzureADAdministratorInner object + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerAzureADAdministratorInner>() { + @Override + public ServerAzureADAdministratorInner 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 to the ServerAzureADAdministratorInner object + */ + 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); + } + + /** + * Returns an 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(); + } + + /** + * Returns an 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); + } + + /** + * Returns an 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(); + } + }); + } + + /** + * Returns an 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); + } + + /** + * Returns 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 List<ServerAzureADAdministratorInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns 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 List<ServerAzureADAdministratorInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns 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 List<ServerAzureADAdministratorInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkImpl.java new file mode 100644 index 0000000000000..c6d794e872952 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkImpl.java @@ -0,0 +1,126 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ServerCommunicationLink; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ServerCommunicationLinkImpl extends CreatableUpdatableImpl implements ServerCommunicationLink, ServerCommunicationLink.Definition, ServerCommunicationLink.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String communicationLinkName; + private String cpartnerServer; + private String upartnerServer; + + ServerCommunicationLinkImpl(String name, SqlManager manager) { + super(name, new ServerCommunicationLinkInner()); + this.manager = manager; + // Set resource name + this.communicationLinkName = name; + // + } + + ServerCommunicationLinkImpl(ServerCommunicationLinkInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.communicationLinkName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.communicationLinkName = IdParsingUtils.getValueFromIdByName(inner.id(), "communicationLinks"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerCommunicationLinksInner client = this.manager().inner().serverCommunicationLinks(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.communicationLinkName, this.cpartnerServer) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerCommunicationLinksInner client = this.manager().inner().serverCommunicationLinks(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.communicationLinkName, this.upartnerServer) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerCommunicationLinksInner client = this.manager().inner().serverCommunicationLinks(); + return client.getAsync(this.resourceGroupName, this.serverName, this.communicationLinkName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerServer() { + return this.inner().partnerServer(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerCommunicationLinkImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerCommunicationLinkImpl withPartnerServer(String partnerServer) { + if (isInCreateMode()) { + this.cpartnerServer = partnerServer; + } else { + this.upartnerServer = partnerServer; + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkInner.java new file mode 100644 index 0000000000000..ac50a4f898875 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinkInner.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.v3_2014_04.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Server communication link. + */ +@JsonFlatten +public class ServerCommunicationLinkInner extends ProxyResource { + /** + * The state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The name of the partner server. + */ + @JsonProperty(value = "properties.partnerServer", required = true) + private String partnerServer; + + /** + * Communication link location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Communication link kind. This property is used for Azure Portal + * metadata. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the state. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the name of the partner server. + * + * @return the partnerServer value + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Set the name of the partner server. + * + * @param partnerServer the partnerServer value to set + * @return the ServerCommunicationLinkInner object itself. + */ + public ServerCommunicationLinkInner withPartnerServer(String partnerServer) { + this.partnerServer = partnerServer; + return this; + } + + /** + * Get communication link location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get communication link kind. This property is used for Azure Portal metadata. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksImpl.java new file mode 100644 index 0000000000000..faabfc2663721 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ServerCommunicationLinks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ServerCommunicationLink; + +class ServerCommunicationLinksImpl extends WrapperImpl implements ServerCommunicationLinks { + private final SqlManager manager; + + ServerCommunicationLinksImpl(SqlManager manager) { + super(manager.inner().serverCommunicationLinks()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerCommunicationLinkImpl define(String name) { + return wrapModel(name); + } + + private ServerCommunicationLinkImpl wrapModel(ServerCommunicationLinkInner inner) { + return new ServerCommunicationLinkImpl(inner, manager()); + } + + private ServerCommunicationLinkImpl wrapModel(String name) { + return new ServerCommunicationLinkImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerCommunicationLinksInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServerCommunicationLink call(ServerCommunicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String communicationLinkName) { + ServerCommunicationLinksInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, communicationLinkName) + .map(new Func1() { + @Override + public ServerCommunicationLink call(ServerCommunicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String communicationLinkName) { + ServerCommunicationLinksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, communicationLinkName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksInner.java new file mode 100644 index 0000000000000..af5d1aa35ce5c --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerCommunicationLinksInner.java @@ -0,0 +1,544 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerCommunicationLinks. + */ +public class ServerCommunicationLinksInner { + /** The Retrofit service to perform REST calls. */ + private ServerCommunicationLinksService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerCommunicationLinksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerCommunicationLinksInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerCommunicationLinksService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerCommunicationLinks to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerCommunicationLinksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServerCommunicationLinks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @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.v3_2014_04.ServerCommunicationLinks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @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.v3_2014_04.ServerCommunicationLinks createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerCommunicationLinkInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServerCommunicationLinks beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("communicationLinkName") String communicationLinkName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerCommunicationLinkInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServerCommunicationLinks listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks") + 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); + + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 communicationLinkName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).toBlocking().single().body(); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 communicationLinkName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName), serviceCallback); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String communicationLinkName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, 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); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 ServerCommunicationLinkInner object if successful. + */ + public ServerCommunicationLinkInner get(String resourceGroupName, String serverName, String communicationLinkName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).toBlocking().single().body(); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @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 communicationLinkName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName), serviceCallback); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String communicationLinkName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).map(new Func1, ServerCommunicationLinkInner>() { + @Override + public ServerCommunicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, 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 server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 ServerCommunicationLinkInner object if successful. + */ + public ServerCommunicationLinkInner createOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().last().body(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 createOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer), serviceCallback); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).map(new Func1, ServerCommunicationLinkInner>() { + @Override + public ServerCommunicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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 (partnerServer == null) { + throw new IllegalArgumentException("Parameter partnerServer is required and cannot be null."); + } + ServerCommunicationLinkInner parameters = new ServerCommunicationLinkInner(); + parameters.withPartnerServer(partnerServer); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 ServerCommunicationLinkInner object if successful. + */ + public ServerCommunicationLinkInner beginCreateOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().single().body(); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer), serviceCallback); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).map(new Func1, ServerCommunicationLinkInner>() { + @Override + public ServerCommunicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server communication link. + * + * @param resourceGroupName The 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 communicationLinkName The name of the server communication link. + * @param partnerServer The name of the partner server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerCommunicationLinkInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) { + 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 (communicationLinkName == null) { + throw new IllegalArgumentException("Parameter communicationLinkName 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 (partnerServer == null) { + throw new IllegalArgumentException("Parameter partnerServer is required and cannot be null."); + } + ServerCommunicationLinkInner parameters = new ServerCommunicationLinkInner(); + parameters.withPartnerServer(partnerServer); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, communicationLinkName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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 List<ServerCommunicationLinkInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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 List<ServerCommunicationLinkInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of server communication links. + * + * @param resourceGroupName The 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 List<ServerCommunicationLinkInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesImpl.java new file mode 100644 index 0000000000000..1250113ef312a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionPolicy; + +class ServerConnectionPoliciesImpl extends WrapperImpl implements ServerConnectionPolicies { + private final SqlManager manager; + + ServerConnectionPoliciesImpl(SqlManager manager) { + super(manager.inner().serverConnectionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerConnectionPolicyImpl define(String name) { + return wrapModel(name); + } + + private ServerConnectionPolicyImpl wrapModel(ServerConnectionPolicyInner inner) { + return new ServerConnectionPolicyImpl(inner, manager()); + } + + private ServerConnectionPolicyImpl wrapModel(String name) { + return new ServerConnectionPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerConnectionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerConnectionPolicy call(ServerConnectionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesInner.java new file mode 100644 index 0000000000000..18bd47abeaf5c --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPoliciesInner.java @@ -0,0 +1,251 @@ +/** + * 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.v3_2014_04.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionType; +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.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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerConnectionPolicies. + */ +public class ServerConnectionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ServerConnectionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerConnectionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerConnectionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerConnectionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerConnectionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerConnectionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("connectionPolicyName") String connectionPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerConnectionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("connectionPolicyName") String connectionPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @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 ServerConnectionPolicyInner object if successful. + */ + public ServerConnectionPolicyInner createOrUpdate(String resourceGroupName, String serverName, ServerConnectionType connectionType) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType).toBlocking().single().body(); + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @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, ServerConnectionType connectionType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType), serviceCallback); + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerConnectionType connectionType) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType).map(new Func1, ServerConnectionPolicyInner>() { + @Override + public ServerConnectionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the server's connection 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 connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerConnectionType connectionType) { + 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 (connectionType == null) { + throw new IllegalArgumentException("Parameter connectionType is required and cannot be null."); + } + final String connectionPolicyName = "default"; + ServerConnectionPolicyInner parameters = new ServerConnectionPolicyInner(); + parameters.withConnectionType(connectionType); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, connectionPolicyName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 the server's secure connection 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. + * @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 ServerConnectionPolicyInner object if successful. + */ + public ServerConnectionPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets the server's secure connection 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 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 the server's secure connection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerConnectionPolicyInner>() { + @Override + public ServerConnectionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the server's secure connection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerConnectionPolicyInner 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 connectionPolicyName = "default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, connectionPolicyName, 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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyImpl.java new file mode 100644 index 0000000000000..2bd1e215e5ef7 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyImpl.java @@ -0,0 +1,120 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionType; + +class ServerConnectionPolicyImpl extends CreatableUpdatableImpl implements ServerConnectionPolicy, ServerConnectionPolicy.Definition, ServerConnectionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private ServerConnectionType cconnectionType; + private ServerConnectionType uconnectionType; + + ServerConnectionPolicyImpl(String name, SqlManager manager) { + super(name, new ServerConnectionPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerConnectionPolicyImpl(ServerConnectionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerConnectionPoliciesInner client = this.manager().inner().serverConnectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.cconnectionType) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerConnectionPoliciesInner client = this.manager().inner().serverConnectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.uconnectionType) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerConnectionPoliciesInner client = this.manager().inner().serverConnectionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public ServerConnectionType connectionType() { + return this.inner().connectionType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerConnectionPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerConnectionPolicyImpl withConnectionType(ServerConnectionType connectionType) { + if (isInCreateMode()) { + this.cconnectionType = connectionType; + } else { + this.uconnectionType = connectionType; + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyInner.java new file mode 100644 index 0000000000000..dbb7cde8349a9 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerConnectionPolicyInner.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server secure connection policy. + */ +@JsonFlatten +public class ServerConnectionPolicyInner extends ProxyResource { + /** + * Metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The server connection type. Possible values include: 'Default', 'Proxy', + * 'Redirect'. + */ + @JsonProperty(value = "properties.connectionType", required = true) + private ServerConnectionType connectionType; + + /** + * Get metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the server connection type. Possible values include: 'Default', 'Proxy', 'Redirect'. + * + * @return the connectionType value + */ + public ServerConnectionType connectionType() { + return this.connectionType; + } + + /** + * Set the server connection type. Possible values include: 'Default', 'Proxy', 'Redirect'. + * + * @param connectionType the connectionType value to set + * @return the ServerConnectionPolicyInner object itself. + */ + public ServerConnectionPolicyInner withConnectionType(ServerConnectionType connectionType) { + this.connectionType = connectionType; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageImpl.java new file mode 100644 index 0000000000000..fa503977326be --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ServerUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ServerUsageImpl extends WrapperImpl implements ServerUsage { + private final SqlManager manager; + + ServerUsageImpl(ServerUsageInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime nextResetTime() { + return this.inner().nextResetTime(); + } + + @Override + public String resourceName() { + return this.inner().resourceName(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageInner.java new file mode 100644 index 0000000000000..830745a7bd60f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsageInner.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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents server metrics. + */ +public class ServerUsageInner { + /** + * Name of the server usage metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The name of the resource. + */ + @JsonProperty(value = "resourceName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceName; + + /** + * The metric display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The current value of the metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /** + * The current limit of the metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * The units of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The next reset time for the metric (ISO8601 format). + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime nextResetTime; + + /** + * Get name of the server usage metric. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the name of the resource. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the metric display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the current value of the metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the current limit of the metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get the units of the metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the next reset time for the metric (ISO8601 format). + * + * @return the nextResetTime value + */ + public DateTime nextResetTime() { + return this.nextResetTime; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesImpl.java new file mode 100644 index 0000000000000..494f596c223ca --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ServerUsages; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ServerUsage; + +class ServerUsagesImpl extends WrapperImpl implements ServerUsages { + private final SqlManager manager; + + ServerUsagesImpl(SqlManager manager) { + super(manager.inner().serverUsages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServerUsageImpl wrapModel(ServerUsageInner inner) { + return new ServerUsageImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServerUsagesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServerUsage call(ServerUsageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesInner.java new file mode 100644 index 0000000000000..c402d092c1db8 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServerUsagesInner.java @@ -0,0 +1,152 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerUsages. + */ +public class ServerUsagesInner { + /** The Retrofit service to perform REST calls. */ + private ServerUsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerUsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerUsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerUsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerUsages to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerUsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServerUsages listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages") + 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); + + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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 List<ServerUsageInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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 List<ServerUsageInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns server usages. + * + * @param resourceGroupName The 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 List<ServerUsageInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersImpl.java new file mode 100644 index 0000000000000..a59a186ab4498 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.Servers; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.CheckNameAvailabilityResponse; + +class ServersImpl extends WrapperImpl implements Servers { + private final SqlManager manager; + + ServersImpl(SqlManager manager) { + super(manager.inner().servers()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable checkNameAvailabilityAsync(String name) { + ServersInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResponse call(CheckNameAvailabilityResponseInner inner) { + return new CheckNameAvailabilityResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersInner.java new file mode 100644 index 0000000000000..4e9685d77d39c --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServersInner.java @@ -0,0 +1,143 @@ +/** + * 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.v3_2014_04.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2014_04.CheckNameAvailabilityRequest; +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.Body; +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 Servers. + */ +public class ServersInner { + /** The Retrofit service to perform REST calls. */ + private ServersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Servers to be + * used by Retrofit to perform actually REST calls. + */ + interface ServersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.Servers checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityRequest parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @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 CheckNameAvailabilityResponseInner object if successful. + */ + public CheckNameAvailabilityResponseInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @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 checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResponseInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityResponseInner>() { + @Override + public CheckNameAvailabilityResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResponseInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + 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 (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailabilityRequest parameters = new CheckNameAvailabilityRequest(); + parameters.withName(name); + return service.checkNameAvailability(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 = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveImpl.java new file mode 100644 index 0000000000000..145a63a5210e4 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveImpl.java @@ -0,0 +1,82 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ServiceObjective; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class ServiceObjectiveImpl extends IndexableRefreshableWrapperImpl implements ServiceObjective { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String serviceObjectiveName; + + ServiceObjectiveImpl(ServiceObjectiveInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.serviceObjectiveName = IdParsingUtils.getValueFromIdByName(inner.id(), "serviceObjectives"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ServiceObjectivesInner client = this.manager().inner().serviceObjectives(); + return client.getAsync(this.resourceGroupName, this.serverName, this.serviceObjectiveName); + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public boolean isDefault() { + return this.inner().isDefault(); + } + + @Override + public boolean isSystem() { + return this.inner().isSystem(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceObjectiveName() { + return this.inner().serviceObjectiveName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveInner.java new file mode 100644 index 0000000000000..49128edcd105f --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectiveInner.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.v3_2014_04.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database service objective. + */ +@JsonFlatten +public class ServiceObjectiveInner extends ProxyResource { + /** + * The name for the service objective. + */ + @JsonProperty(value = "properties.serviceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceObjectiveName; + + /** + * Gets whether the service level objective is the default service + * objective. + */ + @JsonProperty(value = "properties.isDefault", access = JsonProperty.Access.WRITE_ONLY) + private boolean isDefault; + + /** + * Gets whether the service level objective is a system service objective. + */ + @JsonProperty(value = "properties.isSystem", access = JsonProperty.Access.WRITE_ONLY) + private boolean isSystem; + + /** + * The description for the service level objective. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Gets whether the service level objective is enabled. + */ + @JsonProperty(value = "properties.enabled", access = JsonProperty.Access.WRITE_ONLY) + private boolean enabled; + + /** + * Get the name for the service objective. + * + * @return the serviceObjectiveName value + */ + public String serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Get gets whether the service level objective is the default service objective. + * + * @return the isDefault value + */ + public boolean isDefault() { + return this.isDefault; + } + + /** + * Get gets whether the service level objective is a system service objective. + * + * @return the isSystem value + */ + public boolean isSystem() { + return this.isSystem; + } + + /** + * Get the description for the service level objective. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get gets whether the service level objective is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesImpl.java new file mode 100644 index 0000000000000..e8aa5f469c3fa --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ServiceObjectives; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ServiceObjective; + +class ServiceObjectivesImpl extends WrapperImpl implements ServiceObjectives { + private final SqlManager manager; + + ServiceObjectivesImpl(SqlManager manager) { + super(manager.inner().serviceObjectives()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServiceObjectiveImpl wrapModel(ServiceObjectiveInner inner) { + return new ServiceObjectiveImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ServiceObjectivesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServiceObjective call(ServiceObjectiveInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String serviceObjectiveName) { + ServiceObjectivesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, serviceObjectiveName) + .map(new Func1() { + @Override + public ServiceObjective call(ServiceObjectiveInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesInner.java new file mode 100644 index 0000000000000..3c058bff36006 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceObjectivesInner.java @@ -0,0 +1,249 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServiceObjectives. + */ +public class ServiceObjectivesInner { + /** The Retrofit service to perform REST calls. */ + private ServiceObjectivesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceObjectivesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServiceObjectivesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServiceObjectivesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServiceObjectives to be + * used by Retrofit to perform actually REST calls. + */ + interface ServiceObjectivesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServiceObjectives get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("serviceObjectiveName") String serviceObjectiveName, @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.v3_2014_04.ServiceObjectives listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives") + 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); + + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @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 ServiceObjectiveInner object if successful. + */ + public ServiceObjectiveInner get(String resourceGroupName, String serverName, String serviceObjectiveName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, serviceObjectiveName).toBlocking().single().body(); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @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 serviceObjectiveName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, serviceObjectiveName), serviceCallback); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceObjectiveInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String serviceObjectiveName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, serviceObjectiveName).map(new Func1, ServiceObjectiveInner>() { + @Override + public ServiceObjectiveInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database service objective. + * + * @param resourceGroupName The 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 serviceObjectiveName The name of the service objective to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceObjectiveInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String serviceObjectiveName) { + 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 (serviceObjectiveName == null) { + throw new IllegalArgumentException("Parameter serviceObjectiveName 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(this.client.subscriptionId(), resourceGroupName, serverName, serviceObjectiveName, 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); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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 List<ServiceObjectiveInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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 List<ServiceObjectiveInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns database service objectives. + * + * @param resourceGroupName The 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 List<ServiceObjectiveInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorImpl.java new file mode 100644 index 0000000000000..0f6623a970591 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorImpl.java @@ -0,0 +1,158 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.ServiceTierAdvisor; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.SloUsageMetric; + +class ServiceTierAdvisorImpl extends IndexableRefreshableWrapperImpl implements ServiceTierAdvisor { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String serviceTierAdvisorName; + + ServiceTierAdvisorImpl(ServiceTierAdvisorInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.serviceTierAdvisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "serviceTierAdvisors"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ServiceTierAdvisorsInner client = this.manager().inner().serviceTierAdvisors(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.serviceTierAdvisorName); + } + + + + @Override + public Double activeTimeRatio() { + return this.inner().activeTimeRatio(); + } + + @Override + public Double avgDtu() { + return this.inner().avgDtu(); + } + + @Override + public double confidence() { + return this.inner().confidence(); + } + + @Override + public String currentServiceLevelObjective() { + return this.inner().currentServiceLevelObjective(); + } + + @Override + public UUID currentServiceLevelObjectiveId() { + return this.inner().currentServiceLevelObjectiveId(); + } + + @Override + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.inner().databaseSizeBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.inner().databaseSizeBasedRecommendationServiceLevelObjectiveId(); + } + + @Override + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.inner().disasterPlanBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.inner().disasterPlanBasedRecommendationServiceLevelObjectiveId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double maxDtu() { + return this.inner().maxDtu(); + } + + @Override + public Double maxSizeInGB() { + return this.inner().maxSizeInGB(); + } + + @Override + public Double minDtu() { + return this.inner().minDtu(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime observationPeriodEnd() { + return this.inner().observationPeriodEnd(); + } + + @Override + public DateTime observationPeriodStart() { + return this.inner().observationPeriodStart(); + } + + @Override + public String overallRecommendationServiceLevelObjective() { + return this.inner().overallRecommendationServiceLevelObjective(); + } + + @Override + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.inner().overallRecommendationServiceLevelObjectiveId(); + } + + @Override + public List serviceLevelObjectiveUsageMetrics() { + return this.inner().serviceLevelObjectiveUsageMetrics(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String usageBasedRecommendationServiceLevelObjective() { + return this.inner().usageBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.inner().usageBasedRecommendationServiceLevelObjectiveId(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorInner.java new file mode 100644 index 0000000000000..de03df672d9b3 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorInner.java @@ -0,0 +1,318 @@ +/** + * 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.v3_2014_04.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.SloUsageMetric; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a Service Tier Advisor. + */ +@JsonFlatten +public class ServiceTierAdvisorInner extends ProxyResource { + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodStart; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodEnd; + + /** + * The activeTimeRatio for service tier advisor. + */ + @JsonProperty(value = "properties.activeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private Double activeTimeRatio; + + /** + * Gets or sets minDtu for service tier advisor. + */ + @JsonProperty(value = "properties.minDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double minDtu; + + /** + * Gets or sets avgDtu for service tier advisor. + */ + @JsonProperty(value = "properties.avgDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double avgDtu; + + /** + * Gets or sets maxDtu for service tier advisor. + */ + @JsonProperty(value = "properties.maxDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxDtu; + + /** + * Gets or sets maxSizeInGB for service tier advisor. + */ + @JsonProperty(value = "properties.maxSizeInGB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxSizeInGB; + + /** + * Gets or sets serviceLevelObjectiveUsageMetrics for the service tier + * advisor. + */ + @JsonProperty(value = "properties.serviceLevelObjectiveUsageMetrics", access = JsonProperty.Access.WRITE_ONLY) + private List serviceLevelObjectiveUsageMetrics; + + /** + * Gets or sets currentServiceLevelObjective for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceLevelObjective; + + /** + * Gets or sets currentServiceLevelObjectiveId for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceLevelObjectiveId; + + /** + * Gets or sets usageBasedRecommendationServiceLevelObjective for service + * tier advisor. + */ + @JsonProperty(value = "properties.usageBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String usageBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty(value = "properties.usageBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID usageBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty(value = "properties.databaseSizeBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String databaseSizeBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty(value = "properties.databaseSizeBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseSizeBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty(value = "properties.disasterPlanBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String disasterPlanBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty(value = "properties.disasterPlanBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID disasterPlanBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets overallRecommendationServiceLevelObjective for service tier + * advisor. + */ + @JsonProperty(value = "properties.overallRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String overallRecommendationServiceLevelObjective; + + /** + * Gets or sets overallRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty(value = "properties.overallRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID overallRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets confidence for service tier advisor. + */ + @JsonProperty(value = "properties.confidence", access = JsonProperty.Access.WRITE_ONLY) + private double confidence; + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodStart value + */ + public DateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value + */ + public DateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get the activeTimeRatio for service tier advisor. + * + * @return the activeTimeRatio value + */ + public Double activeTimeRatio() { + return this.activeTimeRatio; + } + + /** + * Get gets or sets minDtu for service tier advisor. + * + * @return the minDtu value + */ + public Double minDtu() { + return this.minDtu; + } + + /** + * Get gets or sets avgDtu for service tier advisor. + * + * @return the avgDtu value + */ + public Double avgDtu() { + return this.avgDtu; + } + + /** + * Get gets or sets maxDtu for service tier advisor. + * + * @return the maxDtu value + */ + public Double maxDtu() { + return this.maxDtu; + } + + /** + * Get gets or sets maxSizeInGB for service tier advisor. + * + * @return the maxSizeInGB value + */ + public Double maxSizeInGB() { + return this.maxSizeInGB; + } + + /** + * Get gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. + * + * @return the serviceLevelObjectiveUsageMetrics value + */ + public List serviceLevelObjectiveUsageMetrics() { + return this.serviceLevelObjectiveUsageMetrics; + } + + /** + * Get gets or sets currentServiceLevelObjective for service tier advisor. + * + * @return the currentServiceLevelObjective value + */ + public String currentServiceLevelObjective() { + return this.currentServiceLevelObjective; + } + + /** + * Get gets or sets currentServiceLevelObjectiveId for service tier advisor. + * + * @return the currentServiceLevelObjectiveId value + */ + public UUID currentServiceLevelObjectiveId() { + return this.currentServiceLevelObjectiveId; + } + + /** + * Get gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjective value + */ + public String usageBasedRecommendationServiceLevelObjective() { + return this.usageBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjectiveId value + */ + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.usageBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjective value + */ + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.databaseSizeBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value + */ + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.databaseSizeBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjective value + */ + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.disasterPlanBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value + */ + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.disasterPlanBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets overallRecommendationServiceLevelObjective for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjective value + */ + public String overallRecommendationServiceLevelObjective() { + return this.overallRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjectiveId value + */ + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.overallRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets confidence for service tier advisor. + * + * @return the confidence value + */ + public double confidence() { + return this.confidence; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsImpl.java new file mode 100644 index 0000000000000..9350638da344a --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsImpl.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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.ServiceTierAdvisors; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.ServiceTierAdvisor; + +class ServiceTierAdvisorsImpl extends WrapperImpl implements ServiceTierAdvisors { + private final SqlManager manager; + + ServiceTierAdvisorsImpl(SqlManager manager) { + super(manager.inner().serviceTierAdvisors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServiceTierAdvisorImpl wrapModel(ServiceTierAdvisorInner inner) { + return new ServiceTierAdvisorImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + ServiceTierAdvisorsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServiceTierAdvisor call(ServiceTierAdvisorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + ServiceTierAdvisorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName) + .map(new Func1() { + @Override + public ServiceTierAdvisor call(ServiceTierAdvisorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsInner.java new file mode 100644 index 0000000000000..24639a3fa8612 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/ServiceTierAdvisorsInner.java @@ -0,0 +1,263 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServiceTierAdvisors. + */ +public class ServiceTierAdvisorsInner { + /** The Retrofit service to perform REST calls. */ + private ServiceTierAdvisorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceTierAdvisorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServiceTierAdvisorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServiceTierAdvisorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServiceTierAdvisors to be + * used by Retrofit to perform actually REST calls. + */ + interface ServiceTierAdvisorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.ServiceTierAdvisors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("serviceTierAdvisorName") String serviceTierAdvisorName, @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.v3_2014_04.ServiceTierAdvisors listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 ServiceTierAdvisorInner object if successful. + */ + public ServiceTierAdvisorInner get(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).toBlocking().single().body(); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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, String serviceTierAdvisorName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName), serviceCallback); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceTierAdvisorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).map(new Func1, ServiceTierAdvisorInner>() { + @Override + public ServiceTierAdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceTierAdvisorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (serviceTierAdvisorName == null) { + throw new IllegalArgumentException("Parameter serviceTierAdvisorName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, serviceTierAdvisorName, 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); + } + + /** + * Returns service tier advisors for specified 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 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 List<ServiceTierAdvisorInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns service tier advisors for specified 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 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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServiceTierAdvisorInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServiceTierAdvisorInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..ec8e8075c6398 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManagementClientImpl.java @@ -0,0 +1,504 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The RecoverableDatabasesInner object to access its operations. + */ + private RecoverableDatabasesInner recoverableDatabases; + + /** + * Gets the RecoverableDatabasesInner object to access its operations. + * @return the RecoverableDatabasesInner object. + */ + public RecoverableDatabasesInner recoverableDatabases() { + return this.recoverableDatabases; + } + + /** + * The RestorableDroppedDatabasesInner object to access its operations. + */ + private RestorableDroppedDatabasesInner restorableDroppedDatabases; + + /** + * Gets the RestorableDroppedDatabasesInner object to access its operations. + * @return the RestorableDroppedDatabasesInner object. + */ + public RestorableDroppedDatabasesInner restorableDroppedDatabases() { + return this.restorableDroppedDatabases; + } + + /** + * The ServersInner object to access its operations. + */ + private ServersInner servers; + + /** + * Gets the ServersInner object to access its operations. + * @return the ServersInner object. + */ + public ServersInner servers() { + return this.servers; + } + + /** + * The ServerConnectionPoliciesInner object to access its operations. + */ + private ServerConnectionPoliciesInner serverConnectionPolicies; + + /** + * Gets the ServerConnectionPoliciesInner object to access its operations. + * @return the ServerConnectionPoliciesInner object. + */ + public ServerConnectionPoliciesInner serverConnectionPolicies() { + return this.serverConnectionPolicies; + } + + /** + * The DatabaseThreatDetectionPoliciesInner object to access its operations. + */ + private DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies; + + /** + * Gets the DatabaseThreatDetectionPoliciesInner object to access its operations. + * @return the DatabaseThreatDetectionPoliciesInner object. + */ + public DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies() { + return this.databaseThreatDetectionPolicies; + } + + /** + * The DataMaskingPoliciesInner object to access its operations. + */ + private DataMaskingPoliciesInner dataMaskingPolicies; + + /** + * Gets the DataMaskingPoliciesInner object to access its operations. + * @return the DataMaskingPoliciesInner object. + */ + public DataMaskingPoliciesInner dataMaskingPolicies() { + return this.dataMaskingPolicies; + } + + /** + * The DataMaskingRulesInner object to access its operations. + */ + private DataMaskingRulesInner dataMaskingRules; + + /** + * Gets the DataMaskingRulesInner object to access its operations. + * @return the DataMaskingRulesInner object. + */ + public DataMaskingRulesInner dataMaskingRules() { + return this.dataMaskingRules; + } + + /** + * The FirewallRulesInner object to access its operations. + */ + private FirewallRulesInner firewallRules; + + /** + * Gets the FirewallRulesInner object to access its operations. + * @return the FirewallRulesInner object. + */ + public FirewallRulesInner firewallRules() { + return this.firewallRules; + } + + /** + * The GeoBackupPoliciesInner object to access its operations. + */ + private GeoBackupPoliciesInner geoBackupPolicies; + + /** + * Gets the GeoBackupPoliciesInner object to access its operations. + * @return the GeoBackupPoliciesInner object. + */ + public GeoBackupPoliciesInner geoBackupPolicies() { + return this.geoBackupPolicies; + } + + /** + * 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 RecommendedElasticPoolsInner object to access its operations. + */ + private RecommendedElasticPoolsInner recommendedElasticPools; + + /** + * Gets the RecommendedElasticPoolsInner object to access its operations. + * @return the RecommendedElasticPoolsInner object. + */ + public RecommendedElasticPoolsInner recommendedElasticPools() { + return this.recommendedElasticPools; + } + + /** + * The ReplicationLinksInner object to access its operations. + */ + private ReplicationLinksInner replicationLinks; + + /** + * Gets the ReplicationLinksInner object to access its operations. + * @return the ReplicationLinksInner object. + */ + public ReplicationLinksInner replicationLinks() { + return this.replicationLinks; + } + + /** + * 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 ServerCommunicationLinksInner object to access its operations. + */ + private ServerCommunicationLinksInner serverCommunicationLinks; + + /** + * Gets the ServerCommunicationLinksInner object to access its operations. + * @return the ServerCommunicationLinksInner object. + */ + public ServerCommunicationLinksInner serverCommunicationLinks() { + return this.serverCommunicationLinks; + } + + /** + * The ServiceObjectivesInner object to access its operations. + */ + private ServiceObjectivesInner serviceObjectives; + + /** + * Gets the ServiceObjectivesInner object to access its operations. + * @return the ServiceObjectivesInner object. + */ + public ServiceObjectivesInner serviceObjectives() { + return this.serviceObjectives; + } + + /** + * The ElasticPoolActivitiesInner object to access its operations. + */ + private ElasticPoolActivitiesInner elasticPoolActivities; + + /** + * Gets the ElasticPoolActivitiesInner object to access its operations. + * @return the ElasticPoolActivitiesInner object. + */ + public ElasticPoolActivitiesInner elasticPoolActivities() { + return this.elasticPoolActivities; + } + + /** + * The ElasticPoolDatabaseActivitiesInner object to access its operations. + */ + private ElasticPoolDatabaseActivitiesInner elasticPoolDatabaseActivities; + + /** + * Gets the ElasticPoolDatabaseActivitiesInner object to access its operations. + * @return the ElasticPoolDatabaseActivitiesInner object. + */ + public ElasticPoolDatabaseActivitiesInner elasticPoolDatabaseActivities() { + return this.elasticPoolDatabaseActivities; + } + + /** + * The ServiceTierAdvisorsInner object to access its operations. + */ + private ServiceTierAdvisorsInner serviceTierAdvisors; + + /** + * Gets the ServiceTierAdvisorsInner object to access its operations. + * @return the ServiceTierAdvisorsInner object. + */ + public ServiceTierAdvisorsInner serviceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** + * The TransparentDataEncryptionsInner object to access its operations. + */ + private TransparentDataEncryptionsInner transparentDataEncryptions; + + /** + * Gets the TransparentDataEncryptionsInner object to access its operations. + * @return the TransparentDataEncryptionsInner object. + */ + public TransparentDataEncryptionsInner transparentDataEncryptions() { + return this.transparentDataEncryptions; + } + + /** + * The TransparentDataEncryptionActivitiesInner object to access its operations. + */ + private TransparentDataEncryptionActivitiesInner transparentDataEncryptionActivities; + + /** + * Gets the TransparentDataEncryptionActivitiesInner object to access its operations. + * @return the TransparentDataEncryptionActivitiesInner object. + */ + public TransparentDataEncryptionActivitiesInner transparentDataEncryptionActivities() { + return this.transparentDataEncryptionActivities; + } + + /** + * The ServerUsagesInner object to access its operations. + */ + private ServerUsagesInner serverUsages; + + /** + * Gets the ServerUsagesInner object to access its operations. + * @return the ServerUsagesInner object. + */ + public ServerUsagesInner serverUsages() { + return this.serverUsages; + } + + /** + * The DatabaseUsagesInner object to access its operations. + */ + private DatabaseUsagesInner databaseUsages; + + /** + * Gets the DatabaseUsagesInner object to access its operations. + * @return the DatabaseUsagesInner object. + */ + public DatabaseUsagesInner databaseUsages() { + return this.databaseUsages; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2014-04-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.recoverableDatabases = new RecoverableDatabasesInner(restClient().retrofit(), this); + this.restorableDroppedDatabases = new RestorableDroppedDatabasesInner(restClient().retrofit(), this); + this.servers = new ServersInner(restClient().retrofit(), this); + this.serverConnectionPolicies = new ServerConnectionPoliciesInner(restClient().retrofit(), this); + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesInner(restClient().retrofit(), this); + this.dataMaskingPolicies = new DataMaskingPoliciesInner(restClient().retrofit(), this); + this.dataMaskingRules = new DataMaskingRulesInner(restClient().retrofit(), this); + this.firewallRules = new FirewallRulesInner(restClient().retrofit(), this); + this.geoBackupPolicies = new GeoBackupPoliciesInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); + this.recommendedElasticPools = new RecommendedElasticPoolsInner(restClient().retrofit(), this); + this.replicationLinks = new ReplicationLinksInner(restClient().retrofit(), this); + this.serverAzureADAdministrators = new ServerAzureADAdministratorsInner(restClient().retrofit(), this); + this.serverCommunicationLinks = new ServerCommunicationLinksInner(restClient().retrofit(), this); + this.serviceObjectives = new ServiceObjectivesInner(restClient().retrofit(), this); + this.elasticPoolActivities = new ElasticPoolActivitiesInner(restClient().retrofit(), this); + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesInner(restClient().retrofit(), this); + this.serviceTierAdvisors = new ServiceTierAdvisorsInner(restClient().retrofit(), this); + this.transparentDataEncryptions = new TransparentDataEncryptionsInner(restClient().retrofit(), this); + this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesInner(restClient().retrofit(), this); + this.serverUsages = new ServerUsagesInner(restClient().retrofit(), this); + this.databaseUsages = new DatabaseUsagesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2014-04-01"); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManager.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManager.java new file mode 100644 index 0000000000000..1d9356fe366eb --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/SqlManager.java @@ -0,0 +1,363 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v3_2014_04.RecoverableDatabases; +import com.microsoft.azure.management.sql.v3_2014_04.RestorableDroppedDatabases; +import com.microsoft.azure.management.sql.v3_2014_04.Servers; +import com.microsoft.azure.management.sql.v3_2014_04.ServerConnectionPolicies; +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseThreatDetectionPolicies; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingPolicies; +import com.microsoft.azure.management.sql.v3_2014_04.DataMaskingRules; +import com.microsoft.azure.management.sql.v3_2014_04.FirewallRules; +import com.microsoft.azure.management.sql.v3_2014_04.GeoBackupPolicies; +import com.microsoft.azure.management.sql.v3_2014_04.Databases; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPools; +import com.microsoft.azure.management.sql.v3_2014_04.RecommendedElasticPools; +import com.microsoft.azure.management.sql.v3_2014_04.ReplicationLinks; +import com.microsoft.azure.management.sql.v3_2014_04.ServerAzureADAdministrators; +import com.microsoft.azure.management.sql.v3_2014_04.ServerCommunicationLinks; +import com.microsoft.azure.management.sql.v3_2014_04.ServiceObjectives; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolActivities; +import com.microsoft.azure.management.sql.v3_2014_04.ElasticPoolDatabaseActivities; +import com.microsoft.azure.management.sql.v3_2014_04.ServiceTierAdvisors; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptions; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionActivities; +import com.microsoft.azure.management.sql.v3_2014_04.ServerUsages; +import com.microsoft.azure.management.sql.v3_2014_04.DatabaseUsages; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private RecoverableDatabases recoverableDatabases; + private RestorableDroppedDatabases restorableDroppedDatabases; + private Servers servers; + private ServerConnectionPolicies serverConnectionPolicies; + private DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies; + private DataMaskingPolicies dataMaskingPolicies; + private DataMaskingRules dataMaskingRules; + private FirewallRules firewallRules; + private GeoBackupPolicies geoBackupPolicies; + private Databases databases; + private ElasticPools elasticPools; + private RecommendedElasticPools recommendedElasticPools; + private ReplicationLinks replicationLinks; + private ServerAzureADAdministrators serverAzureADAdministrators; + private ServerCommunicationLinks serverCommunicationLinks; + private ServiceObjectives serviceObjectives; + private ElasticPoolActivities elasticPoolActivities; + private ElasticPoolDatabaseActivities elasticPoolDatabaseActivities; + private ServiceTierAdvisors serviceTierAdvisors; + private TransparentDataEncryptions transparentDataEncryptions; + private TransparentDataEncryptionActivities transparentDataEncryptionActivities; + private ServerUsages serverUsages; + private DatabaseUsages databaseUsages; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage RecoverableDatabases. + */ + public RecoverableDatabases recoverableDatabases() { + if (this.recoverableDatabases == null) { + this.recoverableDatabases = new RecoverableDatabasesImpl(this); + } + return this.recoverableDatabases; + } + + /** + * @return Entry point to manage RestorableDroppedDatabases. + */ + public RestorableDroppedDatabases restorableDroppedDatabases() { + if (this.restorableDroppedDatabases == null) { + this.restorableDroppedDatabases = new RestorableDroppedDatabasesImpl(this); + } + return this.restorableDroppedDatabases; + } + + /** + * @return Entry point to manage Servers. + */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(this); + } + return this.servers; + } + + /** + * @return Entry point to manage ServerConnectionPolicies. + */ + public ServerConnectionPolicies serverConnectionPolicies() { + if (this.serverConnectionPolicies == null) { + this.serverConnectionPolicies = new ServerConnectionPoliciesImpl(this); + } + return this.serverConnectionPolicies; + } + + /** + * @return Entry point to manage DatabaseThreatDetectionPolicies. + */ + public DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies() { + if (this.databaseThreatDetectionPolicies == null) { + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesImpl(this); + } + return this.databaseThreatDetectionPolicies; + } + + /** + * @return Entry point to manage DataMaskingPolicies. + */ + public DataMaskingPolicies dataMaskingPolicies() { + if (this.dataMaskingPolicies == null) { + this.dataMaskingPolicies = new DataMaskingPoliciesImpl(this); + } + return this.dataMaskingPolicies; + } + + /** + * @return Entry point to manage DataMaskingRules. + */ + public DataMaskingRules dataMaskingRules() { + if (this.dataMaskingRules == null) { + this.dataMaskingRules = new DataMaskingRulesImpl(this); + } + return this.dataMaskingRules; + } + + /** + * @return Entry point to manage FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(this); + } + return this.firewallRules; + } + + /** + * @return Entry point to manage GeoBackupPolicies. + */ + public GeoBackupPolicies geoBackupPolicies() { + if (this.geoBackupPolicies == null) { + this.geoBackupPolicies = new GeoBackupPoliciesImpl(this); + } + return this.geoBackupPolicies; + } + + /** + * @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 RecommendedElasticPools. + */ + public RecommendedElasticPools recommendedElasticPools() { + if (this.recommendedElasticPools == null) { + this.recommendedElasticPools = new RecommendedElasticPoolsImpl(this); + } + return this.recommendedElasticPools; + } + + /** + * @return Entry point to manage ReplicationLinks. + */ + public ReplicationLinks replicationLinks() { + if (this.replicationLinks == null) { + this.replicationLinks = new ReplicationLinksImpl(this); + } + return this.replicationLinks; + } + + /** + * @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 ServerCommunicationLinks. + */ + public ServerCommunicationLinks serverCommunicationLinks() { + if (this.serverCommunicationLinks == null) { + this.serverCommunicationLinks = new ServerCommunicationLinksImpl(this); + } + return this.serverCommunicationLinks; + } + + /** + * @return Entry point to manage ServiceObjectives. + */ + public ServiceObjectives serviceObjectives() { + if (this.serviceObjectives == null) { + this.serviceObjectives = new ServiceObjectivesImpl(this); + } + return this.serviceObjectives; + } + + /** + * @return Entry point to manage ElasticPoolActivities. + */ + public ElasticPoolActivities elasticPoolActivities() { + if (this.elasticPoolActivities == null) { + this.elasticPoolActivities = new ElasticPoolActivitiesImpl(this); + } + return this.elasticPoolActivities; + } + + /** + * @return Entry point to manage ElasticPoolDatabaseActivities. + */ + public ElasticPoolDatabaseActivities elasticPoolDatabaseActivities() { + if (this.elasticPoolDatabaseActivities == null) { + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesImpl(this); + } + return this.elasticPoolDatabaseActivities; + } + + /** + * @return Entry point to manage ServiceTierAdvisors. + */ + public ServiceTierAdvisors serviceTierAdvisors() { + if (this.serviceTierAdvisors == null) { + this.serviceTierAdvisors = new ServiceTierAdvisorsImpl(this); + } + return this.serviceTierAdvisors; + } + + /** + * @return Entry point to manage TransparentDataEncryptions. + */ + public TransparentDataEncryptions transparentDataEncryptions() { + if (this.transparentDataEncryptions == null) { + this.transparentDataEncryptions = new TransparentDataEncryptionsImpl(this); + } + return this.transparentDataEncryptions; + } + + /** + * @return Entry point to manage TransparentDataEncryptionActivities. + */ + public TransparentDataEncryptionActivities transparentDataEncryptionActivities() { + if (this.transparentDataEncryptionActivities == null) { + this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesImpl(this); + } + return this.transparentDataEncryptionActivities; + } + + /** + * @return Entry point to manage ServerUsages. + */ + public ServerUsages serverUsages() { + if (this.serverUsages == null) { + this.serverUsages = new ServerUsagesImpl(this); + } + return this.serverUsages; + } + + /** + * @return Entry point to manage DatabaseUsages. + */ + public DatabaseUsages databaseUsages() { + if (this.databaseUsages == null) { + this.databaseUsages = new DatabaseUsagesImpl(this); + } + return this.databaseUsages; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesImpl.java new file mode 100644 index 0000000000000..fdeb845fde527 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionActivity; + +class TransparentDataEncryptionActivitiesImpl extends WrapperImpl implements TransparentDataEncryptionActivities { + private final SqlManager manager; + + TransparentDataEncryptionActivitiesImpl(SqlManager manager) { + super(manager.inner().transparentDataEncryptionActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionActivitiesInner client = this.inner(); + return client.listByConfigurationAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public TransparentDataEncryptionActivity call(TransparentDataEncryptionActivityInner inner) { + return new TransparentDataEncryptionActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesInner.java new file mode 100644 index 0000000000000..9892653874697 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivitiesInner.java @@ -0,0 +1,160 @@ +/** + * 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.v3_2014_04.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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TransparentDataEncryptionActivities. + */ +public class TransparentDataEncryptionActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private TransparentDataEncryptionActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransparentDataEncryptionActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TransparentDataEncryptionActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TransparentDataEncryptionActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface TransparentDataEncryptionActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionActivities listByConfiguration" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults") + Observable> listByConfiguration(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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 List<TransparentDataEncryptionActivityInner> object if successful. + */ + public List listByConfiguration(String resourceGroupName, String serverName, String databaseName) { + return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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> listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionActivityInner> object + */ + public Observable> listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName) { + return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionActivityInner> object + */ + public Observable>> listByConfigurationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + return service.listByConfiguration(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByConfigurationDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByConfigurationDelegate(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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityImpl.java new file mode 100644 index 0000000000000..4d9f5c40bdc6b --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityImpl.java @@ -0,0 +1,57 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionActivityStatus; + +class TransparentDataEncryptionActivityImpl extends WrapperImpl implements TransparentDataEncryptionActivity { + private final SqlManager manager; + TransparentDataEncryptionActivityImpl(TransparentDataEncryptionActivityInner 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 location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Double percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public TransparentDataEncryptionActivityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityInner.java new file mode 100644 index 0000000000000..75ced274376cf --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionActivityInner.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionActivityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database transparent data encryption Scan. + */ +@JsonFlatten +public class TransparentDataEncryptionActivityInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The status of the database. Possible values include: 'Encrypting', + * 'Decrypting'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private TransparentDataEncryptionActivityStatus status; + + /** + * The percent complete of the transparent data encryption scan for a + * database. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Double percentComplete; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the status of the database. Possible values include: 'Encrypting', 'Decrypting'. + * + * @return the status value + */ + public TransparentDataEncryptionActivityStatus status() { + return this.status; + } + + /** + * Get the percent complete of the transparent data encryption scan for a database. + * + * @return the percentComplete value + */ + public Double percentComplete() { + return this.percentComplete; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..67c9e5db94cb6 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionImpl.java @@ -0,0 +1,52 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryption; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionStatus; + +class TransparentDataEncryptionImpl extends WrapperImpl implements TransparentDataEncryption { + private final SqlManager manager; + TransparentDataEncryptionImpl(TransparentDataEncryptionInner 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 location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public TransparentDataEncryptionStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..4ebd5be4c56a5 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionInner.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.v3_2014_04.implementation; + +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database transparent data encryption configuration. + */ +@JsonFlatten +public class TransparentDataEncryptionInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The status of the database transparent data encryption. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private TransparentDataEncryptionStatus status; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public TransparentDataEncryptionStatus status() { + return this.status; + } + + /** + * Set the status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled'. + * + * @param status the status value to set + * @return the TransparentDataEncryptionInner object itself. + */ + public TransparentDataEncryptionInner withStatus(TransparentDataEncryptionStatus status) { + this.status = status; + return this; + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsImpl.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsImpl.java new file mode 100644 index 0000000000000..0fcc4b4dc6faa --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.v3_2014_04.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryption; + +class TransparentDataEncryptionsImpl extends WrapperImpl implements TransparentDataEncryptions { + private final SqlManager manager; + + TransparentDataEncryptionsImpl(SqlManager manager) { + super(manager.inner().transparentDataEncryptions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public TransparentDataEncryption call(TransparentDataEncryptionInner inner) { + return new TransparentDataEncryptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public TransparentDataEncryption call(TransparentDataEncryptionInner inner) { + return new TransparentDataEncryptionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsInner.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsInner.java new file mode 100644 index 0000000000000..894feaaee206e --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/TransparentDataEncryptionsInner.java @@ -0,0 +1,352 @@ +/** + * 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.v3_2014_04.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptionStatus; +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.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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TransparentDataEncryptions. + */ +public class TransparentDataEncryptionsInner { + /** The Retrofit service to perform REST calls. */ + private TransparentDataEncryptionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransparentDataEncryptionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TransparentDataEncryptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TransparentDataEncryptions to be + * used by Retrofit to perform actually REST calls. + */ + interface TransparentDataEncryptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransparentDataEncryptionInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2014_04.TransparentDataEncryptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + final TransparentDataEncryptionStatus status = null; + TransparentDataEncryptionInner parameters = new TransparentDataEncryptionInner(); + parameters.withStatus(null); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status).toBlocking().single().body(); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @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, TransparentDataEncryptionStatus status, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status), serviceCallback); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + TransparentDataEncryptionInner parameters = new TransparentDataEncryptionInner(); + parameters.withStatus(status); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @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 transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 transparentDataEncryptionName = "current"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, 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/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/package-info.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/package-info.java new file mode 100644 index 0000000000000..4e3ee961e7add --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2014_04.implementation; diff --git a/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/package-info.java b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/package-info.java new file mode 100644 index 0000000000000..9c3a22068bd44 --- /dev/null +++ b/sql/resource-manager/v3_2014_04/src/main/java/com/microsoft/azure/management/sql/v3_2014_04/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2014_04; diff --git a/sql/resource-manager/v3_2015_05/pom.xml b/sql/resource-manager/v3_2015_05/pom.xml new file mode 100644 index 0000000000000..66ca467b9a4e1 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v3_2015_05 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningDisabledReason.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningDisabledReason.java new file mode 100644 index 0000000000000..f9e2379dc52dc --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningDisabledReason.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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningDisabledReason. + */ +public enum AutomaticTuningDisabledReason { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value AutoConfigured. */ + AUTO_CONFIGURED("AutoConfigured"), + + /** Enum value InheritedFromServer. */ + INHERITED_FROM_SERVER("InheritedFromServer"), + + /** Enum value QueryStoreOff. */ + QUERY_STORE_OFF("QueryStoreOff"), + + /** Enum value QueryStoreReadOnly. */ + QUERY_STORE_READ_ONLY("QueryStoreReadOnly"), + + /** Enum value NotSupported. */ + NOT_SUPPORTED("NotSupported"); + + /** The actual serialized value for a AutomaticTuningDisabledReason instance. */ + private String value; + + AutomaticTuningDisabledReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningDisabledReason instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningDisabledReason object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningDisabledReason fromString(String value) { + AutomaticTuningDisabledReason[] items = AutomaticTuningDisabledReason.values(); + for (AutomaticTuningDisabledReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningMode.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningMode.java new file mode 100644 index 0000000000000..d0f6cdbc46b55 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningMode.java @@ -0,0 +1,59 @@ +/** + * 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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningMode. + */ +public enum AutomaticTuningMode { + /** Enum value Inherit. */ + INHERIT("Inherit"), + + /** Enum value Custom. */ + CUSTOM("Custom"), + + /** Enum value Auto. */ + AUTO("Auto"), + + /** Enum value Unspecified. */ + UNSPECIFIED("Unspecified"); + + /** The actual serialized value for a AutomaticTuningMode instance. */ + private String value; + + AutomaticTuningMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningMode object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningMode fromString(String value) { + AutomaticTuningMode[] items = AutomaticTuningMode.values(); + for (AutomaticTuningMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeActual.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeActual.java new file mode 100644 index 0000000000000..aa6c4f57be087 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeActual.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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeActual. + */ +public enum AutomaticTuningOptionModeActual { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"); + + /** The actual serialized value for a AutomaticTuningOptionModeActual instance. */ + private String value; + + AutomaticTuningOptionModeActual(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeActual instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeActual object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeActual fromString(String value) { + AutomaticTuningOptionModeActual[] items = AutomaticTuningOptionModeActual.values(); + for (AutomaticTuningOptionModeActual item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeDesired.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeDesired.java new file mode 100644 index 0000000000000..ef219045d7029 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptionModeDesired.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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeDesired. + */ +public enum AutomaticTuningOptionModeDesired { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutomaticTuningOptionModeDesired instance. */ + private String value; + + AutomaticTuningOptionModeDesired(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeDesired instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeDesired object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeDesired fromString(String value) { + AutomaticTuningOptionModeDesired[] items = AutomaticTuningOptionModeDesired.values(); + for (AutomaticTuningOptionModeDesired item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptions.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptions.java new file mode 100644 index 0000000000000..41bcdf23c9e39 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/AutomaticTuningOptions.java @@ -0,0 +1,93 @@ +/** + * 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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Automatic tuning properties for individual advisors. + */ +public class AutomaticTuningOptions { + /** + * Automatic tuning option desired state. Possible values include: 'Off', + * 'On', 'Default'. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /** + * Automatic tuning option actual state. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningOptionModeActual actualState; + + /** + * Reason code if desired and actual state are different. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer reasonCode; + + /** + * Reason description if desired and actual state are different. Possible + * values include: 'Default', 'Disabled', 'AutoConfigured', + * 'InheritedFromServer', 'QueryStoreOff', 'QueryStoreReadOnly', + * 'NotSupported'. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningDisabledReason reasonDesc; + + /** + * Get automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @return the desiredState value + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @param desiredState the desiredState value to set + * @return the AutomaticTuningOptions object itself. + */ + public AutomaticTuningOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning option actual state. Possible values include: 'Off', 'On'. + * + * @return the actualState value + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get reason code if desired and actual state are different. + * + * @return the reasonCode value + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get reason description if desired and actual state are different. Possible values include: 'Default', 'Disabled', 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', 'QueryStoreReadOnly', 'NotSupported'. + * + * @return the reasonDesc value + */ + public AutomaticTuningDisabledReason reasonDesc() { + return this.reasonDesc; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTuning.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTuning.java new file mode 100644 index 0000000000000..be7a5b7f959cc --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTuning.java @@ -0,0 +1,51 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.DatabaseAutomaticTuningInner; +import java.util.Map; + +/** + * Type representing DatabaseAutomaticTuning. + */ +public interface DatabaseAutomaticTuning extends HasInner, HasManager { + /** + * @return the actualState value. + */ + AutomaticTuningMode actualState(); + + /** + * @return the desiredState value. + */ + AutomaticTuningMode desiredState(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the options value. + */ + Map options(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTunings.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTunings.java new file mode 100644 index 0000000000000..d0c3c7c6ca7e5 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/DatabaseAutomaticTunings.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.v3_2015_05; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.DatabaseAutomaticTuningInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.DatabaseAutomaticTuningsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseAutomaticTunings. + */ +public interface DatabaseAutomaticTunings extends HasInner { + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtector.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtector.java new file mode 100644 index 0000000000000..e26280aba3018 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtector.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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.EncryptionProtectorInner; + +/** + * Type representing EncryptionProtector. + */ +public interface EncryptionProtector extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the subregion value. + */ + String subregion(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtectors.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtectors.java new file mode 100644 index 0000000000000..d449bc1b08312 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/EncryptionProtectors.java @@ -0,0 +1,51 @@ +/** + * 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.v3_2015_05; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.EncryptionProtectorInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.EncryptionProtectorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EncryptionProtectors. + */ +public interface EncryptionProtectors extends HasInner { + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The 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); + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The 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); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroup.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroup.java new file mode 100644 index 0000000000000..ef3cdcafd7867 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroup.java @@ -0,0 +1,217 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.FailoverGroupInner; +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.v3_2015_05.implementation.SqlManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing FailoverGroup. + */ +public interface FailoverGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the databases value. + */ + List databases(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerServers value. + */ + List partnerServers(); + + /** + * @return the readOnlyEndpoint value. + */ + FailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * @return the readWriteEndpoint value. + */ + FailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * @return the replicationRole value. + */ + FailoverGroupReplicationRole replicationRole(); + + /** + * @return the replicationState value. + */ + String replicationState(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FailoverGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithPartnerServers, DefinitionStages.WithReadWriteEndpoint, DefinitionStages.WithCreate { + } + + /** + * Grouping of FailoverGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FailoverGroup definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the failovergroup definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithPartnerServers withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the failovergroup definition allowing to specify PartnerServers. + */ + interface WithPartnerServers { + /** + * Specifies partnerServers. + */ + WithReadWriteEndpoint withPartnerServers(List partnerServers); + } + + /** + * The stage of the failovergroup definition allowing to specify ReadWriteEndpoint. + */ + interface WithReadWriteEndpoint { + /** + * Specifies readWriteEndpoint. + */ + WithCreate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + + /** + * The stage of the failovergroup definition allowing to specify Databases. + */ + interface WithDatabases { + /** + * Specifies databases. + */ + WithCreate withDatabases(List databases); + } + + /** + * The stage of the failovergroup definition allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + WithCreate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + /** + * The stage of the failovergroup definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + 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.WithDatabases, DefinitionStages.WithReadOnlyEndpoint, DefinitionStages.WithTags { + } + } + /** + * The template for a FailoverGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDatabases, UpdateStages.WithReadOnlyEndpoint, UpdateStages.WithReadWriteEndpoint, UpdateStages.WithTags { + } + + /** + * Grouping of FailoverGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the failovergroup update allowing to specify Databases. + */ + interface WithDatabases { + /** + * Specifies databases. + */ + Update withDatabases(List databases); + } + + /** + * The stage of the failovergroup update allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + Update withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + /** + * The stage of the failovergroup update allowing to specify ReadWriteEndpoint. + */ + interface WithReadWriteEndpoint { + /** + * Specifies readWriteEndpoint. + */ + Update withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + + /** + * The stage of the failovergroup update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadOnlyEndpoint.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..f27f7d773d743 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadOnlyEndpoint.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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-only endpoint of the failover group instance. + */ +public class FailoverGroupReadOnlyEndpoint { + /** + * Failover policy of the read-only endpoint for the failover group. + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @return the failoverPolicy value + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the FailoverGroupReadOnlyEndpoint object itself. + */ + public FailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadWriteEndpoint.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..6bd785674a7db --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReadWriteEndpoint.java @@ -0,0 +1,73 @@ +/** + * 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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-write endpoint of the failover group instance. + */ +public class FailoverGroupReadWriteEndpoint { + /** + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /** + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @return the failoverPolicy value + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the FailoverGroupReadWriteEndpoint object itself. + */ + public FailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverWithDataLossGracePeriodMinutes value + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set + * @return the FailoverGroupReadWriteEndpoint object itself. + */ + public FailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes(Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReplicationRole.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..f30e83a16d573 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupReplicationRole.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FailoverGroupReplicationRole. + */ +public final class FailoverGroupReplicationRole extends ExpandableStringEnum { + /** Static value Primary for FailoverGroupReplicationRole. */ + public static final FailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for FailoverGroupReplicationRole. */ + public static final FailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a FailoverGroupReplicationRole from its string representation. + * @param name a name to look for + * @return the corresponding FailoverGroupReplicationRole + */ + @JsonCreator + public static FailoverGroupReplicationRole fromString(String name) { + return fromString(name, FailoverGroupReplicationRole.class); + } + + /** + * @return known FailoverGroupReplicationRole values + */ + public static Collection values() { + return values(FailoverGroupReplicationRole.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupUpdate.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupUpdate.java new file mode 100644 index 0000000000000..766892eac4d5a --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroupUpdate.java @@ -0,0 +1,125 @@ +/** + * 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.v3_2015_05; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A failover group update request. + */ +@JsonFlatten +public class FailoverGroupUpdate { + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint") + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * List of databases in the failover group. + */ + @JsonProperty(value = "properties.databases") + private List databases; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get list of databases in the failover group. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Set list of databases in the failover group. + * + * @param databases the databases value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withDatabases(List databases) { + this.databases = databases; + 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 FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroups.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroups.java new file mode 100644 index 0000000000000..59c90bcb3330a --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/FailoverGroups.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.FailoverGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FailoverGroups. + */ +public interface FailoverGroups extends SupportsCreating, HasInner { + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable failoverAsync(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String failoverGroupName); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/IdentityType.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/IdentityType.java new file mode 100644 index 0000000000000..ea24b9f900eeb --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/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.v3_2015_05; + +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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstance.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstance.java new file mode 100644 index 0000000000000..7b8b16733b2b2 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstance.java @@ -0,0 +1,323 @@ +/** + * 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.v3_2015_05; + +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.v3_2015_05.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.ManagedInstanceInner; + +/** + * Type representing ManagedInstance. + */ +public interface ManagedInstance extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, 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 identity value. + */ + ResourceIdentity identity(); + + /** + * @return the licenseType value. + */ + String licenseType(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the storageSizeInGB value. + */ + Integer storageSizeInGB(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * @return the vCores value. + */ + Integer vCores(); + + /** + * The entirety of the ManagedInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstance definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstance definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ManagedInstance definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the managedinstance update allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the managedinstance update allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the managedinstance update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the managedinstance update allowing to specify DnsZonePartner. + */ + interface WithDnsZonePartner { + /** + * Specifies dnsZonePartner. + */ + WithCreate withDnsZonePartner(String dnsZonePartner); + } + + /** + * The stage of the managedinstance update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + + /** + * The stage of the managedinstance update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(String licenseType); + } + + /** + * The stage of the managedinstance update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the managedinstance update allowing to specify StorageSizeInGB. + */ + interface WithStorageSizeInGB { + /** + * Specifies storageSizeInGB. + */ + WithCreate withStorageSizeInGB(Integer storageSizeInGB); + } + + /** + * The stage of the managedinstance update allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + */ + WithCreate withSubnetId(String subnetId); + } + + /** + * The stage of the managedinstance update allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + */ + 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, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores { + } + } + /** + * The template for a ManagedInstance update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithVCores { + } + + /** + * Grouping of ManagedInstance update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstance {0} allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + Update withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the managedinstance {0} allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the managedinstance {0} allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the managedinstance {0} allowing to specify DnsZonePartner. + */ + interface WithDnsZonePartner { + /** + * Specifies dnsZonePartner. + */ + Update withDnsZonePartner(String dnsZonePartner); + } + + /** + * The stage of the managedinstance {0} allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(String licenseType); + } + + /** + * The stage of the managedinstance {0} allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the managedinstance {0} allowing to specify StorageSizeInGB. + */ + interface WithStorageSizeInGB { + /** + * Specifies storageSizeInGB. + */ + Update withStorageSizeInGB(Integer storageSizeInGB); + } + + /** + * The stage of the managedinstance {0} allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + */ + Update withSubnetId(String subnetId); + } + + /** + * The stage of the managedinstance {0} allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + */ + Update withVCores(Integer vCores); + } + + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstanceUpdate.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstanceUpdate.java new file mode 100644 index 0000000000000..87cb1826d5e74 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstanceUpdate.java @@ -0,0 +1,329 @@ +/** + * 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.v3_2015_05; + +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; + + /** + * 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' and 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * The number of VCores. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * The maximum storage size in GB. + */ + @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; + + /** + * 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 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' and 'BasePrice'. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the number of VCores. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the number of VCores. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the maximum storage size in GB. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the maximum storage size in GB. + * + * @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 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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstances.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstances.java new file mode 100644 index 0000000000000..618a7ce830015 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ManagedInstances.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.v3_2015_05; + +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.v3_2015_05.implementation.ManagedInstancesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstances. + */ +public interface ManagedInstances extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operation.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operation.java new file mode 100644 index 0000000000000..3cf26955ba777 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operation.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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.OperationInner; +import java.util.Map; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + OperationOrigin origin(); + + /** + * @return the properties value. + */ + Map properties(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationDisplay.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationDisplay.java new file mode 100644 index 0000000000000..b0dd5831a4963 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationDisplay.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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * The localized friendly form of the resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * The localized friendly form of the resource type related to this + * action/operation. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * The localized friendly name for the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The localized friendly description for the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the localized friendly form of the resource provider name. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the localized friendly form of the resource type related to this action/operation. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the localized friendly name for the operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the localized friendly description for the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationOrigin.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationOrigin.java new file mode 100644 index 0000000000000..720d31302f0a8 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/OperationOrigin.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OperationOrigin. + */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * @param name a name to look for + * @return the corresponding OperationOrigin + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** + * @return known OperationOrigin values + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operations.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operations.java new file mode 100644 index 0000000000000..22bd10a6077de --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.v3_2015_05; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/PartnerInfo.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/PartnerInfo.java new file mode 100644 index 0000000000000..7e414c52dbe81 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/PartnerInfo.java @@ -0,0 +1,74 @@ +/** + * 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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Partner server information for the failover group. + */ +public class PartnerInfo { + /** + * Resource identifier of the partner server. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Geo location of the partner server. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Replication role of the partner server. Possible values include: + * 'Primary', 'Secondary'. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /** + * Get resource identifier of the partner server. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource identifier of the partner server. + * + * @param id the id value to set + * @return the PartnerInfo object itself. + */ + public PartnerInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get geo location of the partner server. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get replication role of the partner server. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadOnlyEndpointFailoverPolicy.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadOnlyEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..5562be4bbca47 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadOnlyEndpointFailoverPolicy.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadOnlyEndpointFailoverPolicy. + */ +public final class ReadOnlyEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Disabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy DISABLED = fromString("Disabled"); + + /** Static value Enabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy ENABLED = fromString("Enabled"); + + /** + * Creates or finds a ReadOnlyEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadOnlyEndpointFailoverPolicy + */ + @JsonCreator + public static ReadOnlyEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadOnlyEndpointFailoverPolicy.class); + } + + /** + * @return known ReadOnlyEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadOnlyEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadWriteEndpointFailoverPolicy.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadWriteEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..8616e722f2ecf --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ReadWriteEndpointFailoverPolicy.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadWriteEndpointFailoverPolicy. + */ +public final class ReadWriteEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Manual for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy MANUAL = fromString("Manual"); + + /** Static value Automatic for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a ReadWriteEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadWriteEndpointFailoverPolicy + */ + @JsonCreator + public static ReadWriteEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadWriteEndpointFailoverPolicy.class); + } + + /** + * @return known ReadWriteEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadWriteEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ResourceIdentity.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ResourceIdentity.java new file mode 100644 index 0000000000000..f97076e363b5a --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/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.v3_2015_05; + +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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Server.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Server.java new file mode 100644 index 0000000000000..2ea7ca558b3b3 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Server.java @@ -0,0 +1,173 @@ +/** + * 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.v3_2015_05; + +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.v3_2015_05.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.ServerInner; + +/** + * Type representing Server. + */ +public interface Server extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the version value. + */ + String version(); + + /** + * The entirety of the Server definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Server definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Server definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Server definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the server update allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the server update allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the server update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + + /** + * The stage of the server update allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + */ + WithCreate withVersion(String version); + } + + /** + * 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.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithIdentity, DefinitionStages.WithVersion { + } + } + /** + * The template for a Server update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithVersion { + } + + /** + * Grouping of Server update stages. + */ + interface UpdateStages { + /** + * The stage of the server {0} allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + Update withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the server {0} allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the server {0} allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + */ + Update withVersion(String version); + } + + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKey.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKey.java new file mode 100644 index 0000000000000..4fe73052562a8 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKey.java @@ -0,0 +1,211 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.ServerKeyInner; +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.v3_2015_05.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ServerKey. + */ +public interface ServerKey extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the subregion value. + */ + String subregion(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + + /** + * The entirety of the ServerKey definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithServerKeyType, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerKey definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerKey definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverkey definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithServerKeyType withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverkey definition allowing to specify ServerKeyType. + */ + interface WithServerKeyType { + /** + * Specifies serverKeyType. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + + /** + * The stage of the serverkey definition allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + */ + WithCreate withCreationDate(DateTime creationDate); + } + + /** + * The stage of the serverkey definition allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + */ + WithCreate withKind(String kind); + } + + /** + * The stage of the serverkey definition allowing to specify Thumbprint. + */ + interface WithThumbprint { + /** + * Specifies thumbprint. + */ + WithCreate withThumbprint(String thumbprint); + } + + /** + * The stage of the serverkey definition allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + WithCreate withUri(String uri); + } + + /** + * 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.WithCreationDate, DefinitionStages.WithKind, DefinitionStages.WithThumbprint, DefinitionStages.WithUri { + } + } + /** + * The template for a ServerKey update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCreationDate, UpdateStages.WithKind, UpdateStages.WithThumbprint, UpdateStages.WithUri { + } + + /** + * Grouping of ServerKey update stages. + */ + interface UpdateStages { + /** + * The stage of the serverkey update allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + */ + Update withCreationDate(DateTime creationDate); + } + + /** + * The stage of the serverkey update allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + */ + Update withKind(String kind); + } + + /** + * The stage of the serverkey update allowing to specify Thumbprint. + */ + interface WithThumbprint { + /** + * Specifies thumbprint. + */ + Update withThumbprint(String thumbprint); + } + + /** + * The stage of the serverkey update allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + Update withUri(String uri); + } + + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeyType.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeyType.java new file mode 100644 index 0000000000000..b4a102b2c28bb --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeyType.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServerKeyType. + */ +public final class ServerKeyType extends ExpandableStringEnum { + /** Static value ServiceManaged for ServerKeyType. */ + public static final ServerKeyType SERVICE_MANAGED = fromString("ServiceManaged"); + + /** Static value AzureKeyVault for ServerKeyType. */ + public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates or finds a ServerKeyType from its string representation. + * @param name a name to look for + * @return the corresponding ServerKeyType + */ + @JsonCreator + public static ServerKeyType fromString(String name) { + return fromString(name, ServerKeyType.class); + } + + /** + * @return known ServerKeyType values + */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeys.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeys.java new file mode 100644 index 0000000000000..89414c16d27fc --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerKeys.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.v3_2015_05; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.ServerKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerKeys. + */ +public interface ServerKeys extends SupportsCreating, HasInner { + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String keyName); + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The 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 the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String keyName); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerUpdate.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerUpdate.java new file mode 100644 index 0000000000000..673c8fccbb953 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/ServerUpdate.java @@ -0,0 +1,155 @@ +/** + * 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.v3_2015_05; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database server. + */ +@JsonFlatten +public class ServerUpdate { + /** + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The version of the server. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * The state of the server. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the server. Once created it cannot be changed. + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for server creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version of the server. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version of the server. + * + * @param version the version value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state of the server. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * 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 ServerUpdate object itself. + */ + public ServerUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Servers.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Servers.java new file mode 100644 index 0000000000000..a6cc280e7b768 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Servers.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.v3_2015_05; + +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.v3_2015_05.implementation.ServersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Servers. + */ +public interface Servers extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Sku.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Sku.java new file mode 100644 index 0000000000000..a732d69861ec2 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/Sku.java @@ -0,0 +1,152 @@ +/** + * 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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the 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 if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsage.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsage.java new file mode 100644 index 0000000000000..7c385cb8e3272 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsage.java @@ -0,0 +1,57 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SubscriptionUsageInner; +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.v3_2015_05.implementation.SqlManager; + +/** + * Type representing SubscriptionUsage. + */ +public interface SubscriptionUsage extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsages.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsages.java new file mode 100644 index 0000000000000..a31dde66e800c --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SubscriptionUsages.java @@ -0,0 +1,37 @@ +/** + * 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.v3_2015_05; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.SubscriptionUsage; + +/** + * Type representing SubscriptionUsages. + */ +public interface SubscriptionUsages { + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String locationName, String usageName); + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String locationName); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgent.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgent.java new file mode 100644 index 0000000000000..2d5db143f07d9 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgent.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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncAgentInner; +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.v3_2015_05.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing SyncAgent. + */ +public interface SyncAgent extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the expiryTime value. + */ + DateTime expiryTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isUpToDate value. + */ + Boolean isUpToDate(); + + /** + * @return the lastAliveTime value. + */ + DateTime lastAliveTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + SyncAgentState state(); + + /** + * @return the syncAgentName value. + */ + String syncAgentName(); + + /** + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the version value. + */ + String version(); + + /** + * The entirety of the SyncAgent definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of SyncAgent definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SyncAgent definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the syncagent definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + + /** + * 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 { + } + } + /** + * The template for a SyncAgent update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of SyncAgent update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentKeyProperties.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentKeyProperties.java new file mode 100644 index 0000000000000..8d8baa25b165f --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentKeyProperties.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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncAgentKeyPropertiesInner; + +/** + * Type representing SyncAgentKeyProperties. + */ +public interface SyncAgentKeyProperties extends HasInner, HasManager { + /** + * @return the syncAgentKey value. + */ + String syncAgentKey(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentLinkedDatabase.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentLinkedDatabase.java new file mode 100644 index 0000000000000..6f80b6a7ee305 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentLinkedDatabase.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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncAgentLinkedDatabaseInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; + +/** + * Type representing SyncAgentLinkedDatabase. + */ +public interface SyncAgentLinkedDatabase extends HasInner, HasManager { + /** + * @return the databaseId value. + */ + String databaseId(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userName value. + */ + String userName(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentState.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentState.java new file mode 100644 index 0000000000000..591f628cbafcc --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgentState.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncAgentState. + */ +public final class SyncAgentState extends ExpandableStringEnum { + /** Static value Online for SyncAgentState. */ + public static final SyncAgentState ONLINE = fromString("Online"); + + /** Static value Offline for SyncAgentState. */ + public static final SyncAgentState OFFLINE = fromString("Offline"); + + /** Static value NeverConnected for SyncAgentState. */ + public static final SyncAgentState NEVER_CONNECTED = fromString("NeverConnected"); + + /** + * Creates or finds a SyncAgentState from its string representation. + * @param name a name to look for + * @return the corresponding SyncAgentState + */ + @JsonCreator + public static SyncAgentState fromString(String name) { + return fromString(name, SyncAgentState.class); + } + + /** + * @return known SyncAgentState values + */ + public static Collection values() { + return values(SyncAgentState.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgents.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgents.java new file mode 100644 index 0000000000000..d00d635fbd5b9 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncAgents.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.v3_2015_05; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncAgentsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgentLinkedDatabase; + +/** + * Type representing SyncAgents. + */ +public interface SyncAgents extends SupportsCreating, HasInner { + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String syncAgentName); + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncConflictResolutionPolicy.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncConflictResolutionPolicy.java new file mode 100644 index 0000000000000..7fbab75c970ac --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncConflictResolutionPolicy.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncConflictResolutionPolicy. + */ +public final class SyncConflictResolutionPolicy extends ExpandableStringEnum { + /** Static value HubWin for SyncConflictResolutionPolicy. */ + public static final SyncConflictResolutionPolicy HUB_WIN = fromString("HubWin"); + + /** Static value MemberWin for SyncConflictResolutionPolicy. */ + public static final SyncConflictResolutionPolicy MEMBER_WIN = fromString("MemberWin"); + + /** + * Creates or finds a SyncConflictResolutionPolicy from its string representation. + * @param name a name to look for + * @return the corresponding SyncConflictResolutionPolicy + */ + @JsonCreator + public static SyncConflictResolutionPolicy fromString(String name) { + return fromString(name, SyncConflictResolutionPolicy.class); + } + + /** + * @return known SyncConflictResolutionPolicy values + */ + public static Collection values() { + return values(SyncConflictResolutionPolicy.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDatabaseIdProperties.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDatabaseIdProperties.java new file mode 100644 index 0000000000000..c90afc907255f --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDatabaseIdProperties.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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncDatabaseIdPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; + +/** + * Type representing SyncDatabaseIdProperties. + */ +public interface SyncDatabaseIdProperties extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDirection.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDirection.java new file mode 100644 index 0000000000000..ad2591cbe976b --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncDirection.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncDirection. + */ +public final class SyncDirection extends ExpandableStringEnum { + /** Static value Bidirectional for SyncDirection. */ + public static final SyncDirection BIDIRECTIONAL = fromString("Bidirectional"); + + /** Static value OneWayMemberToHub for SyncDirection. */ + public static final SyncDirection ONE_WAY_MEMBER_TO_HUB = fromString("OneWayMemberToHub"); + + /** Static value OneWayHubToMember for SyncDirection. */ + public static final SyncDirection ONE_WAY_HUB_TO_MEMBER = fromString("OneWayHubToMember"); + + /** + * Creates or finds a SyncDirection from its string representation. + * @param name a name to look for + * @return the corresponding SyncDirection + */ + @JsonCreator + public static SyncDirection fromString(String name) { + return fromString(name, SyncDirection.class); + } + + /** + * @return known SyncDirection values + */ + public static Collection values() { + return values(SyncDirection.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTable.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTable.java new file mode 100644 index 0000000000000..0a6d07d7d5f00 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTable.java @@ -0,0 +1,93 @@ +/** + * 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.v3_2015_05; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the table in the database full schema. + */ +public class SyncFullSchemaTable { + /** + * List of columns in the table of database full schema. + */ + @JsonProperty(value = "columns", access = JsonProperty.Access.WRITE_ONLY) + private List columns; + + /** + * Error id of the table. + */ + @JsonProperty(value = "errorId", access = JsonProperty.Access.WRITE_ONLY) + private String errorId; + + /** + * If there is error in the table. + */ + @JsonProperty(value = "hasError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasError; + + /** + * Name of the table. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Quoted name of the table. + */ + @JsonProperty(value = "quotedName", access = JsonProperty.Access.WRITE_ONLY) + private String quotedName; + + /** + * Get list of columns in the table of database full schema. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Get error id of the table. + * + * @return the errorId value + */ + public String errorId() { + return this.errorId; + } + + /** + * Get if there is error in the table. + * + * @return the hasError value + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get name of the table. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get quoted name of the table. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTableColumn.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTableColumn.java new file mode 100644 index 0000000000000..a2b362b60573b --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncFullSchemaTableColumn.java @@ -0,0 +1,122 @@ +/** + * 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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the column in the table of database full schema. + */ +public class SyncFullSchemaTableColumn { + /** + * Data size of the column. + */ + @JsonProperty(value = "dataSize", access = JsonProperty.Access.WRITE_ONLY) + private String dataSize; + + /** + * Data type of the column. + */ + @JsonProperty(value = "dataType", access = JsonProperty.Access.WRITE_ONLY) + private String dataType; + + /** + * Error id of the column. + */ + @JsonProperty(value = "errorId", access = JsonProperty.Access.WRITE_ONLY) + private String errorId; + + /** + * If there is error in the table. + */ + @JsonProperty(value = "hasError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasError; + + /** + * If it is the primary key of the table. + */ + @JsonProperty(value = "isPrimaryKey", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isPrimaryKey; + + /** + * Name of the column. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Quoted name of the column. + */ + @JsonProperty(value = "quotedName", access = JsonProperty.Access.WRITE_ONLY) + private String quotedName; + + /** + * Get data size of the column. + * + * @return the dataSize value + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Get data type of the column. + * + * @return the dataType value + */ + public String dataType() { + return this.dataType; + } + + /** + * Get error id of the column. + * + * @return the errorId value + */ + public String errorId() { + return this.errorId; + } + + /** + * Get if there is error in the table. + * + * @return the hasError value + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get if it is the primary key of the table. + * + * @return the isPrimaryKey value + */ + public Boolean isPrimaryKey() { + return this.isPrimaryKey; + } + + /** + * Get name of the column. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get quoted name of the column. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroup.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroup.java new file mode 100644 index 0000000000000..4980515121b3d --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroup.java @@ -0,0 +1,246 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncGroupInner; +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.v3_2015_05.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing SyncGroup. + */ +public interface SyncGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the conflictResolutionPolicy value. + */ + SyncConflictResolutionPolicy conflictResolutionPolicy(); + + /** + * @return the hubDatabasePassword value. + */ + String hubDatabasePassword(); + + /** + * @return the hubDatabaseUserName value. + */ + String hubDatabaseUserName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the interval value. + */ + Integer interval(); + + /** + * @return the lastSyncTime value. + */ + DateTime lastSyncTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the schema value. + */ + SyncGroupSchema schema(); + + /** + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * @return the syncState value. + */ + SyncGroupState syncState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SyncGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of SyncGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SyncGroup definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the syncgroup definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the syncgroup definition allowing to specify ConflictResolutionPolicy. + */ + interface WithConflictResolutionPolicy { + /** + * Specifies conflictResolutionPolicy. + */ + WithCreate withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + + /** + * The stage of the syncgroup definition allowing to specify HubDatabasePassword. + */ + interface WithHubDatabasePassword { + /** + * Specifies hubDatabasePassword. + */ + WithCreate withHubDatabasePassword(String hubDatabasePassword); + } + + /** + * The stage of the syncgroup definition allowing to specify HubDatabaseUserName. + */ + interface WithHubDatabaseUserName { + /** + * Specifies hubDatabaseUserName. + */ + WithCreate withHubDatabaseUserName(String hubDatabaseUserName); + } + + /** + * The stage of the syncgroup definition allowing to specify Interval. + */ + interface WithInterval { + /** + * Specifies interval. + */ + WithCreate withInterval(Integer interval); + } + + /** + * The stage of the syncgroup definition allowing to specify Schema. + */ + interface WithSchema { + /** + * Specifies schema. + */ + WithCreate withSchema(SyncGroupSchema schema); + } + + /** + * The stage of the syncgroup definition allowing to specify SyncDatabaseId. + */ + interface WithSyncDatabaseId { + /** + * Specifies syncDatabaseId. + */ + WithCreate withSyncDatabaseId(String syncDatabaseId); + } + + /** + * 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.WithConflictResolutionPolicy, DefinitionStages.WithHubDatabasePassword, DefinitionStages.WithHubDatabaseUserName, DefinitionStages.WithInterval, DefinitionStages.WithSchema, DefinitionStages.WithSyncDatabaseId { + } + } + /** + * The template for a SyncGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithConflictResolutionPolicy, UpdateStages.WithHubDatabasePassword, UpdateStages.WithHubDatabaseUserName, UpdateStages.WithInterval, UpdateStages.WithSchema, UpdateStages.WithSyncDatabaseId { + } + + /** + * Grouping of SyncGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the syncgroup update allowing to specify ConflictResolutionPolicy. + */ + interface WithConflictResolutionPolicy { + /** + * Specifies conflictResolutionPolicy. + */ + Update withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + + /** + * The stage of the syncgroup update allowing to specify HubDatabasePassword. + */ + interface WithHubDatabasePassword { + /** + * Specifies hubDatabasePassword. + */ + Update withHubDatabasePassword(String hubDatabasePassword); + } + + /** + * The stage of the syncgroup update allowing to specify HubDatabaseUserName. + */ + interface WithHubDatabaseUserName { + /** + * Specifies hubDatabaseUserName. + */ + Update withHubDatabaseUserName(String hubDatabaseUserName); + } + + /** + * The stage of the syncgroup update allowing to specify Interval. + */ + interface WithInterval { + /** + * Specifies interval. + */ + Update withInterval(Integer interval); + } + + /** + * The stage of the syncgroup update allowing to specify Schema. + */ + interface WithSchema { + /** + * Specifies schema. + */ + Update withSchema(SyncGroupSchema schema); + } + + /** + * The stage of the syncgroup update allowing to specify SyncDatabaseId. + */ + interface WithSyncDatabaseId { + /** + * Specifies syncDatabaseId. + */ + Update withSyncDatabaseId(String syncDatabaseId); + } + + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupDatabasisServerSyncFullSchemaProperties.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupDatabasisServerSyncFullSchemaProperties.java new file mode 100644 index 0000000000000..39cfa0fa0efea --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupDatabasisServerSyncFullSchemaProperties.java @@ -0,0 +1,32 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncFullSchemaPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing SyncGroupDatabasisServerSyncFullSchemaProperties. + */ +public interface SyncGroupDatabasisServerSyncFullSchemaProperties extends HasInner, HasManager { + /** + * @return the lastUpdateTime value. + */ + DateTime lastUpdateTime(); + + /** + * @return the tables value. + */ + List tables(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogProperties.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogProperties.java new file mode 100644 index 0000000000000..c74e9da3362c6 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogProperties.java @@ -0,0 +1,52 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncGroupLogPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing SyncGroupLogProperties. + */ +public interface SyncGroupLogProperties extends HasInner, HasManager { + /** + * @return the details value. + */ + String details(); + + /** + * @return the operationStatus value. + */ + String operationStatus(); + + /** + * @return the source value. + */ + String source(); + + /** + * @return the timestamp value. + */ + DateTime timestamp(); + + /** + * @return the tracingId value. + */ + UUID tracingId(); + + /** + * @return the type value. + */ + SyncGroupLogType type(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogType.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogType.java new file mode 100644 index 0000000000000..8e786fcb988a5 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupLogType.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncGroupLogType. + */ +public final class SyncGroupLogType extends ExpandableStringEnum { + /** Static value All for SyncGroupLogType. */ + public static final SyncGroupLogType ALL = fromString("All"); + + /** Static value Error for SyncGroupLogType. */ + public static final SyncGroupLogType ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupLogType. */ + public static final SyncGroupLogType WARNING = fromString("Warning"); + + /** Static value Success for SyncGroupLogType. */ + public static final SyncGroupLogType SUCCESS = fromString("Success"); + + /** + * Creates or finds a SyncGroupLogType from its string representation. + * @param name a name to look for + * @return the corresponding SyncGroupLogType + */ + @JsonCreator + public static SyncGroupLogType fromString(String name) { + return fromString(name, SyncGroupLogType.class); + } + + /** + * @return known SyncGroupLogType values + */ + public static Collection values() { + return values(SyncGroupLogType.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchema.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchema.java new file mode 100644 index 0000000000000..61452cb7c3e9b --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchema.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.v3_2015_05; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of sync group schema. + */ +public class SyncGroupSchema { + /** + * List of tables in sync group schema. + */ + @JsonProperty(value = "tables") + private List tables; + + /** + * Name of master sync member where the schema is from. + */ + @JsonProperty(value = "masterSyncMemberName") + private String masterSyncMemberName; + + /** + * Get list of tables in sync group schema. + * + * @return the tables value + */ + public List tables() { + return this.tables; + } + + /** + * Set list of tables in sync group schema. + * + * @param tables the tables value to set + * @return the SyncGroupSchema object itself. + */ + public SyncGroupSchema withTables(List tables) { + this.tables = tables; + return this; + } + + /** + * Get name of master sync member where the schema is from. + * + * @return the masterSyncMemberName value + */ + public String masterSyncMemberName() { + return this.masterSyncMemberName; + } + + /** + * Set name of master sync member where the schema is from. + * + * @param masterSyncMemberName the masterSyncMemberName value to set + * @return the SyncGroupSchema object itself. + */ + public SyncGroupSchema withMasterSyncMemberName(String masterSyncMemberName) { + this.masterSyncMemberName = masterSyncMemberName; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTable.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTable.java new file mode 100644 index 0000000000000..985597d5d69a6 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTable.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.v3_2015_05; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of table in sync group schema. + */ +public class SyncGroupSchemaTable { + /** + * List of columns in sync group schema. + */ + @JsonProperty(value = "columns") + private List columns; + + /** + * Quoted name of sync group schema table. + */ + @JsonProperty(value = "quotedName") + private String quotedName; + + /** + * Get list of columns in sync group schema. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Set list of columns in sync group schema. + * + * @param columns the columns value to set + * @return the SyncGroupSchemaTable object itself. + */ + public SyncGroupSchemaTable withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get quoted name of sync group schema table. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set quoted name of sync group schema table. + * + * @param quotedName the quotedName value to set + * @return the SyncGroupSchemaTable object itself. + */ + public SyncGroupSchemaTable withQuotedName(String quotedName) { + this.quotedName = quotedName; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTableColumn.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTableColumn.java new file mode 100644 index 0000000000000..48aed0e6ce13d --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupSchemaTableColumn.java @@ -0,0 +1,95 @@ +/** + * 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.v3_2015_05; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of column in sync group table. + */ +public class SyncGroupSchemaTableColumn { + /** + * Quoted name of sync group table column. + */ + @JsonProperty(value = "quotedName") + private String quotedName; + + /** + * Data size of the column. + */ + @JsonProperty(value = "dataSize") + private String dataSize; + + /** + * Data type of the column. + */ + @JsonProperty(value = "dataType") + private String dataType; + + /** + * Get quoted name of sync group table column. + * + * @return the quotedName value + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set quoted name of sync group table column. + * + * @param quotedName the quotedName value to set + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withQuotedName(String quotedName) { + this.quotedName = quotedName; + return this; + } + + /** + * Get data size of the column. + * + * @return the dataSize value + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Set data size of the column. + * + * @param dataSize the dataSize value to set + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withDataSize(String dataSize) { + this.dataSize = dataSize; + return this; + } + + /** + * Get data type of the column. + * + * @return the dataType value + */ + public String dataType() { + return this.dataType; + } + + /** + * Set data type of the column. + * + * @param dataType the dataType value to set + * @return the SyncGroupSchemaTableColumn object itself. + */ + public SyncGroupSchemaTableColumn withDataType(String dataType) { + this.dataType = dataType; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupState.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupState.java new file mode 100644 index 0000000000000..9f24f30dd9f83 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroupState.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncGroupState. + */ +public final class SyncGroupState extends ExpandableStringEnum { + /** Static value NotReady for SyncGroupState. */ + public static final SyncGroupState NOT_READY = fromString("NotReady"); + + /** Static value Error for SyncGroupState. */ + public static final SyncGroupState ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupState. */ + public static final SyncGroupState WARNING = fromString("Warning"); + + /** Static value Progressing for SyncGroupState. */ + public static final SyncGroupState PROGRESSING = fromString("Progressing"); + + /** Static value Good for SyncGroupState. */ + public static final SyncGroupState GOOD = fromString("Good"); + + /** + * Creates or finds a SyncGroupState from its string representation. + * @param name a name to look for + * @return the corresponding SyncGroupState + */ + @JsonCreator + public static SyncGroupState fromString(String name) { + return fromString(name, SyncGroupState.class); + } + + /** + * @return known SyncGroupState values + */ + public static Collection values() { + return values(SyncGroupState.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroups.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroups.java new file mode 100644 index 0000000000000..cd58bdc64d234 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncGroups.java @@ -0,0 +1,131 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncGroupsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.SyncDatabaseIdProperties; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupLogProperties; + +/** + * Type representing SyncGroups. + */ +public interface SyncGroups extends SupportsCreating, HasInner { + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @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); + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSyncDatabaseIdsAsync(final String locationName); + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName); + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMember.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMember.java new file mode 100644 index 0000000000000..1296a01012a82 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMember.java @@ -0,0 +1,291 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncMemberInner; +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.v3_2015_05.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing SyncMember. + */ +public interface SyncMember extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the password value. + */ + String password(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the sqlServerDatabaseId value. + */ + UUID sqlServerDatabaseId(); + + /** + * @return the syncAgentId value. + */ + String syncAgentId(); + + /** + * @return the syncDirection value. + */ + SyncDirection syncDirection(); + + /** + * @return the syncState value. + */ + SyncMemberState syncState(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userName value. + */ + String userName(); + + /** + * The entirety of the SyncMember definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithSyncGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of SyncMember definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SyncMember definition. + */ + interface Blank extends WithSyncGroup { + } + + /** + * The stage of the syncmember definition allowing to specify SyncGroup. + */ + interface WithSyncGroup { + /** + * Specifies resourceGroupName, serverName, databaseName, syncGroupName. + */ + WithCreate withExistingSyncGroup(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + } + + /** + * The stage of the syncmember definition allowing to specify DatabaseName. + */ + interface WithDatabaseName { + /** + * Specifies databaseName. + */ + WithCreate withDatabaseName(String databaseName); + } + + /** + * The stage of the syncmember definition allowing to specify DatabaseType. + */ + interface WithDatabaseType { + /** + * Specifies databaseType. + */ + WithCreate withDatabaseType(SyncMemberDbType databaseType); + } + + /** + * The stage of the syncmember definition allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + */ + WithCreate withPassword(String password); + } + + /** + * The stage of the syncmember definition allowing to specify ServerName. + */ + interface WithServerName { + /** + * Specifies serverName. + */ + WithCreate withServerName(String serverName); + } + + /** + * The stage of the syncmember definition allowing to specify SqlServerDatabaseId. + */ + interface WithSqlServerDatabaseId { + /** + * Specifies sqlServerDatabaseId. + */ + WithCreate withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + + /** + * The stage of the syncmember definition allowing to specify SyncAgentId. + */ + interface WithSyncAgentId { + /** + * Specifies syncAgentId. + */ + WithCreate withSyncAgentId(String syncAgentId); + } + + /** + * The stage of the syncmember definition allowing to specify SyncDirection. + */ + interface WithSyncDirection { + /** + * Specifies syncDirection. + */ + WithCreate withSyncDirection(SyncDirection syncDirection); + } + + /** + * The stage of the syncmember definition allowing to specify UserName. + */ + interface WithUserName { + /** + * Specifies userName. + */ + WithCreate withUserName(String userName); + } + + /** + * 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.WithDatabaseName, DefinitionStages.WithDatabaseType, DefinitionStages.WithPassword, DefinitionStages.WithServerName, DefinitionStages.WithSqlServerDatabaseId, DefinitionStages.WithSyncAgentId, DefinitionStages.WithSyncDirection, DefinitionStages.WithUserName { + } + } + /** + * The template for a SyncMember update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDatabaseName, UpdateStages.WithDatabaseType, UpdateStages.WithPassword, UpdateStages.WithServerName, UpdateStages.WithSqlServerDatabaseId, UpdateStages.WithSyncAgentId, UpdateStages.WithSyncDirection, UpdateStages.WithUserName { + } + + /** + * Grouping of SyncMember update stages. + */ + interface UpdateStages { + /** + * The stage of the syncmember update allowing to specify DatabaseName. + */ + interface WithDatabaseName { + /** + * Specifies databaseName. + */ + Update withDatabaseName(String databaseName); + } + + /** + * The stage of the syncmember update allowing to specify DatabaseType. + */ + interface WithDatabaseType { + /** + * Specifies databaseType. + */ + Update withDatabaseType(SyncMemberDbType databaseType); + } + + /** + * The stage of the syncmember update allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + */ + Update withPassword(String password); + } + + /** + * The stage of the syncmember update allowing to specify ServerName. + */ + interface WithServerName { + /** + * Specifies serverName. + */ + Update withServerName(String serverName); + } + + /** + * The stage of the syncmember update allowing to specify SqlServerDatabaseId. + */ + interface WithSqlServerDatabaseId { + /** + * Specifies sqlServerDatabaseId. + */ + Update withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + + /** + * The stage of the syncmember update allowing to specify SyncAgentId. + */ + interface WithSyncAgentId { + /** + * Specifies syncAgentId. + */ + Update withSyncAgentId(String syncAgentId); + } + + /** + * The stage of the syncmember update allowing to specify SyncDirection. + */ + interface WithSyncDirection { + /** + * Specifies syncDirection. + */ + Update withSyncDirection(SyncDirection syncDirection); + } + + /** + * The stage of the syncmember update allowing to specify UserName. + */ + interface WithUserName { + /** + * Specifies userName. + */ + Update withUserName(String userName); + } + + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberDbType.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberDbType.java new file mode 100644 index 0000000000000..f03a97fd1ca67 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberDbType.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncMemberDbType. + */ +public final class SyncMemberDbType extends ExpandableStringEnum { + /** Static value AzureSqlDatabase for SyncMemberDbType. */ + public static final SyncMemberDbType AZURE_SQL_DATABASE = fromString("AzureSqlDatabase"); + + /** Static value SqlServerDatabase for SyncMemberDbType. */ + public static final SyncMemberDbType SQL_SERVER_DATABASE = fromString("SqlServerDatabase"); + + /** + * Creates or finds a SyncMemberDbType from its string representation. + * @param name a name to look for + * @return the corresponding SyncMemberDbType + */ + @JsonCreator + public static SyncMemberDbType fromString(String name) { + return fromString(name, SyncMemberDbType.class); + } + + /** + * @return known SyncMemberDbType values + */ + public static Collection values() { + return values(SyncMemberDbType.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberState.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberState.java new file mode 100644 index 0000000000000..946d05a4633c2 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberState.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SyncMemberState. + */ +public final class SyncMemberState extends ExpandableStringEnum { + /** Static value SyncInProgress for SyncMemberState. */ + public static final SyncMemberState SYNC_IN_PROGRESS = fromString("SyncInProgress"); + + /** Static value SyncSucceeded for SyncMemberState. */ + public static final SyncMemberState SYNC_SUCCEEDED = fromString("SyncSucceeded"); + + /** Static value SyncFailed for SyncMemberState. */ + public static final SyncMemberState SYNC_FAILED = fromString("SyncFailed"); + + /** Static value DisabledTombstoneCleanup for SyncMemberState. */ + public static final SyncMemberState DISABLED_TOMBSTONE_CLEANUP = fromString("DisabledTombstoneCleanup"); + + /** Static value DisabledBackupRestore for SyncMemberState. */ + public static final SyncMemberState DISABLED_BACKUP_RESTORE = fromString("DisabledBackupRestore"); + + /** Static value SyncSucceededWithWarnings for SyncMemberState. */ + public static final SyncMemberState SYNC_SUCCEEDED_WITH_WARNINGS = fromString("SyncSucceededWithWarnings"); + + /** Static value SyncCancelling for SyncMemberState. */ + public static final SyncMemberState SYNC_CANCELLING = fromString("SyncCancelling"); + + /** Static value SyncCancelled for SyncMemberState. */ + public static final SyncMemberState SYNC_CANCELLED = fromString("SyncCancelled"); + + /** Static value UnProvisioned for SyncMemberState. */ + public static final SyncMemberState UN_PROVISIONED = fromString("UnProvisioned"); + + /** Static value Provisioning for SyncMemberState. */ + public static final SyncMemberState PROVISIONING = fromString("Provisioning"); + + /** Static value Provisioned for SyncMemberState. */ + public static final SyncMemberState PROVISIONED = fromString("Provisioned"); + + /** Static value ProvisionFailed for SyncMemberState. */ + public static final SyncMemberState PROVISION_FAILED = fromString("ProvisionFailed"); + + /** Static value DeProvisioning for SyncMemberState. */ + public static final SyncMemberState DE_PROVISIONING = fromString("DeProvisioning"); + + /** Static value DeProvisioned for SyncMemberState. */ + public static final SyncMemberState DE_PROVISIONED = fromString("DeProvisioned"); + + /** Static value DeProvisionFailed for SyncMemberState. */ + public static final SyncMemberState DE_PROVISION_FAILED = fromString("DeProvisionFailed"); + + /** Static value Reprovisioning for SyncMemberState. */ + public static final SyncMemberState REPROVISIONING = fromString("Reprovisioning"); + + /** Static value ReprovisionFailed for SyncMemberState. */ + public static final SyncMemberState REPROVISION_FAILED = fromString("ReprovisionFailed"); + + /** Static value UnReprovisioned for SyncMemberState. */ + public static final SyncMemberState UN_REPROVISIONED = fromString("UnReprovisioned"); + + /** + * Creates or finds a SyncMemberState from its string representation. + * @param name a name to look for + * @return the corresponding SyncMemberState + */ + @JsonCreator + public static SyncMemberState fromString(String name) { + return fromString(name, SyncMemberState.class); + } + + /** + * @return known SyncMemberState values + */ + public static Collection values() { + return values(SyncMemberState.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java new file mode 100644 index 0000000000000..16c6811b4bb12 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties.java @@ -0,0 +1,32 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncFullSchemaPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties. + */ +public interface SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties extends HasInner, HasManager { + /** + * @return the lastUpdateTime value. + */ + DateTime lastUpdateTime(); + + /** + * @return the tables value. + */ + List tables(); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMembers.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMembers.java new file mode 100644 index 0000000000000..537bf224875b9 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/SyncMembers.java @@ -0,0 +1,86 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.SyncMembersInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties; + +/** + * Type representing SyncMembers. + */ +public interface SyncMembers extends SupportsCreating, HasInner { + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName); + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRule.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRule.java new file mode 100644 index 0000000000000..6c43fff034902 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRule.java @@ -0,0 +1,130 @@ +/** + * 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.v3_2015_05; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.VirtualNetworkRuleInner; +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.v3_2015_05.implementation.SqlManager; + +/** + * Type representing VirtualNetworkRule. + */ +public interface VirtualNetworkRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the ignoreMissingVnetServiceEndpoint value. + */ + Boolean ignoreMissingVnetServiceEndpoint(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + VirtualNetworkRuleState state(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * The entirety of the VirtualNetworkRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithVirtualNetworkSubnetId, DefinitionStages.WithCreate { + } + + /** + * Grouping of VirtualNetworkRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a VirtualNetworkRule definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the virtualnetworkrule definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithVirtualNetworkSubnetId withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the virtualnetworkrule definition allowing to specify VirtualNetworkSubnetId. + */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies virtualNetworkSubnetId. + */ + WithCreate withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + + /** + * The stage of the virtualnetworkrule definition allowing to specify IgnoreMissingVnetServiceEndpoint. + */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies ignoreMissingVnetServiceEndpoint. + */ + WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + + /** + * 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.WithIgnoreMissingVnetServiceEndpoint { + } + } + /** + * The template for a VirtualNetworkRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIgnoreMissingVnetServiceEndpoint { + } + + /** + * Grouping of VirtualNetworkRule update stages. + */ + interface UpdateStages { + /** + * The stage of the virtualnetworkrule update allowing to specify IgnoreMissingVnetServiceEndpoint. + */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies ignoreMissingVnetServiceEndpoint. + */ + Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRuleState.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRuleState.java new file mode 100644 index 0000000000000..9069ecf5489c3 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRuleState.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.v3_2015_05; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VirtualNetworkRuleState. + */ +public final class VirtualNetworkRuleState extends ExpandableStringEnum { + /** Static value Initializing for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); + + /** Static value InProgress for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); + + /** Static value Ready for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState READY = fromString("Ready"); + + /** Static value Deleting for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); + + /** Static value Unknown for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a VirtualNetworkRuleState from its string representation. + * @param name a name to look for + * @return the corresponding VirtualNetworkRuleState + */ + @JsonCreator + public static VirtualNetworkRuleState fromString(String name) { + return fromString(name, VirtualNetworkRuleState.class); + } + + /** + * @return known VirtualNetworkRuleState values + */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRules.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRules.java new file mode 100644 index 0000000000000..7c7e4b5cc8ae6 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/VirtualNetworkRules.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.v3_2015_05; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.implementation.VirtualNetworkRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualNetworkRules. + */ +public interface VirtualNetworkRules extends SupportsCreating, HasInner { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a list of virtual network rules in 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 the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName); + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningImpl.java new file mode 100644 index 0000000000000..1b40f8c223fb3 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningImpl.java @@ -0,0 +1,59 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.DatabaseAutomaticTuning; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.AutomaticTuningMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2015_05.AutomaticTuningOptions; + +class DatabaseAutomaticTuningImpl extends WrapperImpl implements DatabaseAutomaticTuning { + private final SqlManager manager; + DatabaseAutomaticTuningImpl(DatabaseAutomaticTuningInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public AutomaticTuningMode actualState() { + return this.inner().actualState(); + } + + @Override + public AutomaticTuningMode desiredState() { + return this.inner().desiredState(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map options() { + return this.inner().options(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningInner.java new file mode 100644 index 0000000000000..4d42d045d119e --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningInner.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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.AutomaticTuningMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2015_05.AutomaticTuningOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Database-level Automatic Tuning. + */ +@JsonFlatten +public class DatabaseAutomaticTuningInner extends ProxyResource { + /** + * Automatic tuning desired state. Possible values include: 'Inherit', + * 'Custom', 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.desiredState") + private AutomaticTuningMode desiredState; + + /** + * Automatic tuning actual state. Possible values include: 'Inherit', + * 'Custom', 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningMode actualState; + + /** + * Automatic tuning options definition. + */ + @JsonProperty(value = "properties.options") + private Map options; + + /** + * Get automatic tuning desired state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified'. + * + * @return the desiredState value + */ + public AutomaticTuningMode desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning desired state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified'. + * + * @param desiredState the desiredState value to set + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withDesiredState(AutomaticTuningMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning actual state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified'. + * + * @return the actualState value + */ + public AutomaticTuningMode actualState() { + return this.actualState; + } + + /** + * Get automatic tuning options definition. + * + * @return the options value + */ + public Map options() { + return this.options; + } + + /** + * Set automatic tuning options definition. + * + * @param options the options value to set + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withOptions(Map options) { + this.options = options; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..d5494caf8d6a1 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.DatabaseAutomaticTunings; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.DatabaseAutomaticTuning; + +class DatabaseAutomaticTuningsImpl extends WrapperImpl implements DatabaseAutomaticTunings { + private final SqlManager manager; + + DatabaseAutomaticTuningsImpl(SqlManager manager) { + super(manager.inner().databaseAutomaticTunings()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseAutomaticTuningsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseAutomaticTuning call(DatabaseAutomaticTuningInner inner) { + return new DatabaseAutomaticTuningImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + DatabaseAutomaticTuningsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serverName, databaseName, parameters) + .map(new Func1() { + @Override + public DatabaseAutomaticTuning call(DatabaseAutomaticTuningInner inner) { + return new DatabaseAutomaticTuningImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsInner.java new file mode 100644 index 0000000000000..f1e67d8455352 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/DatabaseAutomaticTuningsInner.java @@ -0,0 +1,261 @@ +/** + * 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.v3_2015_05.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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 DatabaseAutomaticTunings. + */ +public class DatabaseAutomaticTuningsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseAutomaticTuningsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAutomaticTuningsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseAutomaticTuningsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseAutomaticTuningsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseAutomaticTunings to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseAutomaticTuningsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.DatabaseAutomaticTunings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current") + Observable> get(@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.v3_2015_05.DatabaseAutomaticTunings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseAutomaticTuningInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @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 DatabaseAutomaticTuningInner object if successful. + */ + public DatabaseAutomaticTuningInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @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 automatic tuning. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseAutomaticTuningInner>() { + @Override + public DatabaseAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's automatic tuning. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner 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."); + } + return service.get(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 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); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning 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 DatabaseAutomaticTuningInner object if successful. + */ + public DatabaseAutomaticTuningInner update(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning 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 serverName, String databaseName, DatabaseAutomaticTuningInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseAutomaticTuningInner>() { + @Override + public DatabaseAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update automatic tuning properties for target 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. + * @param parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAutomaticTuningInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner 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); + return service.update(resourceGroupName, serverName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorImpl.java new file mode 100644 index 0000000000000..1985c884b3adb --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorImpl.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. + */ + +package com.microsoft.azure.management.sql.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.EncryptionProtector; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.ServerKeyType; + +class EncryptionProtectorImpl extends WrapperImpl implements EncryptionProtector { + private final SqlManager manager; + EncryptionProtectorImpl(EncryptionProtectorInner 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 kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serverKeyName() { + return this.inner().serverKeyName(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String subregion() { + return this.inner().subregion(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorInner.java new file mode 100644 index 0000000000000..7d13aacde9170 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorInner.java @@ -0,0 +1,161 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The server encryption protector. + */ +@JsonFlatten +public class EncryptionProtectorInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Subregion of the encryption protector. + */ + @JsonProperty(value = "properties.subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /** + * The name of the server key. + */ + @JsonProperty(value = "properties.serverKeyName") + private String serverKeyName; + + /** + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * Possible values include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Set kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @param kind the kind value to set + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get subregion of the encryption protector. + * + * @return the subregion value + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the name of the server key. + * + * @return the serverKeyName value + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the name of the server key. + * + * @param serverKeyName the serverKeyName value to set + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the server key. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get thumbprint of the server key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..9d76a06da5c0a --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsImpl.java @@ -0,0 +1,73 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.EncryptionProtectors; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.EncryptionProtector; + +class EncryptionProtectorsImpl extends WrapperImpl implements EncryptionProtectors { + private final SqlManager manager; + + EncryptionProtectorsImpl(SqlManager manager) { + super(manager.inner().encryptionProtectors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + EncryptionProtectorsInner 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 EncryptionProtector call(EncryptionProtectorInner inner) { + return new EncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + EncryptionProtectorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public EncryptionProtector call(EncryptionProtectorInner inner) { + return new EncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + EncryptionProtectorsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serverName, parameters) + .map(new Func1() { + @Override + public EncryptionProtector call(EncryptionProtectorInner inner) { + return new EncryptionProtectorImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsInner.java new file mode 100644 index 0000000000000..8e5967535bde1 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/EncryptionProtectorsInner.java @@ -0,0 +1,580 @@ +/** + * 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.v3_2015_05.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 EncryptionProtectors. + */ +public class EncryptionProtectorsInner { + /** The Retrofit service to perform REST calls. */ + private EncryptionProtectorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of EncryptionProtectorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EncryptionProtectorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(EncryptionProtectorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EncryptionProtectors to be + * used by Retrofit to perform actually REST calls. + */ + interface EncryptionProtectorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.EncryptionProtectors listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector") + 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.v3_2015_05.EncryptionProtectors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @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.v3_2015_05.EncryptionProtectors createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body EncryptionProtectorInner 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.v3_2015_05.EncryptionProtectors beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body EncryptionProtectorInner 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.v3_2015_05.EncryptionProtectors listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of server encryption protectors. + * + * @param resourceGroupName The 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<EncryptionProtectorInner> 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 encryption protectors. + * + * @param resourceGroupName The 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 encryption protectors. + * + * @param resourceGroupName The 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<EncryptionProtectorInner> 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 encryption protectors. + * + * @param resourceGroupName The 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<EncryptionProtectorInner> 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 encryption protectors. + * + 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<EncryptionProtectorInner> 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 a server encryption protector. + * + * @param resourceGroupName The 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 EncryptionProtectorInner object if successful. + */ + public EncryptionProtectorInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The 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 encryption protector. + * + * @param resourceGroupName The 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 EncryptionProtectorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, EncryptionProtectorInner>() { + @Override + public EncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server encryption protector. + * + * @param resourceGroupName The 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 EncryptionProtectorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String encryptionProtectorName = "current"; + return service.get(resourceGroupName, serverName, encryptionProtectorName, 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); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 EncryptionProtectorInner object if successful. + */ + public EncryptionProtectorInner createOrUpdate(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 serverName, EncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, EncryptionProtectorInner>() { + @Override + public EncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, EncryptionProtectorInner 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 (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 encryptionProtectorName = "current"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, encryptionProtectorName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 EncryptionProtectorInner object if successful. + */ + public EncryptionProtectorInner beginCreateOrUpdate(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector 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 serverName, EncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EncryptionProtectorInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, EncryptionProtectorInner>() { + @Override + public EncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EncryptionProtectorInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, EncryptionProtectorInner 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 (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 encryptionProtectorName = "current"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, encryptionProtectorName, 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 list of server encryption protectors. + * + * @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<EncryptionProtectorInner> 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 encryption protectors. + * + * @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 encryption protectors. + * + * @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<EncryptionProtectorInner> 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 encryption protectors. + * + * @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<EncryptionProtectorInner> 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 encryption protectors. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EncryptionProtectorInner> 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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupImpl.java new file mode 100644 index 0000000000000..eb0daf047c04e --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupImpl.java @@ -0,0 +1,208 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroupUpdate; +import java.util.List; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroupReplicationRole; +import com.microsoft.azure.management.sql.v3_2015_05.PartnerInfo; +import rx.functions.Func1; + +class FailoverGroupImpl extends CreatableUpdatableImpl implements FailoverGroup, FailoverGroup.Definition, FailoverGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String failoverGroupName; + private FailoverGroupUpdate updateParameter; + + FailoverGroupImpl(String name, SqlManager manager) { + super(name, new FailoverGroupInner()); + this.manager = manager; + // Set resource name + this.failoverGroupName = name; + // + this.updateParameter = new FailoverGroupUpdate(); + } + + FailoverGroupImpl(FailoverGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.failoverGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.failoverGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "failoverGroups"); + // + this.updateParameter = new FailoverGroupUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FailoverGroupsInner client = this.manager().inner().failoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.failoverGroupName, this.inner()) + .map(new Func1() { + @Override + public FailoverGroupInner call(FailoverGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FailoverGroupsInner client = this.manager().inner().failoverGroups(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.failoverGroupName, this.updateParameter) + .map(new Func1() { + @Override + public FailoverGroupInner call(FailoverGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FailoverGroupsInner client = this.manager().inner().failoverGroups(); + return client.getAsync(this.resourceGroupName, this.serverName, this.failoverGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new FailoverGroupUpdate(); + } + + @Override + public List databases() { + return this.inner().databases(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List partnerServers() { + return this.inner().partnerServers(); + } + + @Override + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.inner().readOnlyEndpoint(); + } + + @Override + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.inner().readWriteEndpoint(); + } + + @Override + public FailoverGroupReplicationRole replicationRole() { + return this.inner().replicationRole(); + } + + @Override + public String replicationState() { + return this.inner().replicationState(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FailoverGroupImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public FailoverGroupImpl withPartnerServers(List partnerServers) { + this.inner().withPartnerServers(partnerServers); + return this; + } + + @Override + public FailoverGroupImpl withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + if (isInCreateMode()) { + this.inner().withReadWriteEndpoint(readWriteEndpoint); + } else { + this.updateParameter.withReadWriteEndpoint(readWriteEndpoint); + } + return this; + } + + @Override + public FailoverGroupImpl withDatabases(List databases) { + if (isInCreateMode()) { + this.inner().withDatabases(databases); + } else { + this.updateParameter.withDatabases(databases); + } + return this; + } + + @Override + public FailoverGroupImpl withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + if (isInCreateMode()) { + this.inner().withReadOnlyEndpoint(readOnlyEndpoint); + } else { + this.updateParameter.withReadOnlyEndpoint(readOnlyEndpoint); + } + return this; + } + + @Override + public FailoverGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupInner.java new file mode 100644 index 0000000000000..08c8ff5ee7fb3 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupInner.java @@ -0,0 +1,202 @@ +/** + * 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.v3_2015_05.implementation; + +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2015_05.PartnerInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A failover group. + */ +@JsonFlatten +public class FailoverGroupInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint", required = true) + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * Local replication role of the failover group instance. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /** + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /** + * List of partner server information for the failover group. + */ + @JsonProperty(value = "properties.partnerServers", required = true) + private List partnerServers; + + /** + * List of databases in the failover group. + */ + @JsonProperty(value = "properties.databases") + private List databases; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * 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 FailoverGroupInner object itself. + */ + public FailoverGroupInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get replication state of the failover group instance. + * + * @return the replicationState value + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get list of partner server information for the failover group. + * + * @return the partnerServers value + */ + public List partnerServers() { + return this.partnerServers; + } + + /** + * Set list of partner server information for the failover group. + * + * @param partnerServers the partnerServers value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withPartnerServers(List partnerServers) { + this.partnerServers = partnerServers; + return this; + } + + /** + * Get list of databases in the failover group. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Set list of databases in the failover group. + * + * @param databases the databases value to set + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withDatabases(List databases) { + this.databases = databases; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsImpl.java new file mode 100644 index 0000000000000..315bea3aba4ba --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsImpl.java @@ -0,0 +1,105 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroup; + +class FailoverGroupsImpl extends WrapperImpl implements FailoverGroups { + private final SqlManager manager; + + FailoverGroupsImpl(SqlManager manager) { + super(manager.inner().failoverGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public FailoverGroupImpl define(String name) { + return wrapModel(name); + } + + private FailoverGroupImpl wrapModel(FailoverGroupInner inner) { + return new FailoverGroupImpl(inner, manager()); + } + + private FailoverGroupImpl wrapModel(String name) { + return new FailoverGroupImpl(name, this.manager()); + } + + @Override + public Observable failoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, failoverGroupName) + .map(new Func1() { + @Override + public FailoverGroup call(FailoverGroupInner inner) { + return new FailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.forceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName) + .map(new Func1() { + @Override + public FailoverGroup call(FailoverGroupInner inner) { + return new FailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + FailoverGroupsInner 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 FailoverGroup call(FailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, failoverGroupName) + .map(new Func1() { + @Override + public FailoverGroup call(FailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, failoverGroupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsInner.java new file mode 100644 index 0000000000000..ac65d9e64afb1 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/FailoverGroupsInner.java @@ -0,0 +1,1330 @@ +/** + * 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.v3_2015_05.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.v3_2015_05.FailoverGroupUpdate; +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 FailoverGroups. + */ +public class FailoverGroupsInner { + /** The Retrofit service to perform REST calls. */ + private FailoverGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of FailoverGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FailoverGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(FailoverGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for FailoverGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface FailoverGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.FailoverGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2015_05.FailoverGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupInner 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.v3_2015_05.FailoverGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupInner 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.v3_2015_05.FailoverGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2015_05.FailoverGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2015_05.FailoverGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdate 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.v3_2015_05.FailoverGroups beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdate 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.v3_2015_05.FailoverGroups listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups") + 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.v3_2015_05.FailoverGroups failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2015_05.FailoverGroups beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2015_05.FailoverGroups forceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> forceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2015_05.FailoverGroups beginForceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> beginForceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2015_05.FailoverGroups listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner get(String resourceGroupName, String serverName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner createOrUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 failoverGroupName, FailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 failoverGroupName, FailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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 failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner update(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 serverName, String failoverGroupName, FailoverGroupUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, serverName, failoverGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 serverName, String failoverGroupName, FailoverGroupUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a failover 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 serverName The name of the server containing the failover group. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, serverName, failoverGroupName, 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); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @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<FailoverGroupInner> 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(); + } + }; + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @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); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FailoverGroupInner> 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(); + } + }); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FailoverGroupInner> 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)); + } + }); + } + + /** + * Lists the failover groups in 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 containing the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FailoverGroupInner> 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); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginFailover(String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, failoverGroupName, 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); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> forceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 FailoverGroupInner object if successful. + */ + public FailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @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 beginForceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable beginForceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1, FailoverGroupInner>() { + @Override + public FailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param resourceGroupName The 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 containing the failover group. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FailoverGroupInner object + */ + public Observable> beginForceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.beginForceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, 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 = beginForceFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginForceFailoverAllowDataLossDelegate(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 the failover groups in 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<FailoverGroupInner> 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(); + } + }; + } + + /** + * Lists the failover groups in 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); + } + + /** + * Lists the failover groups in 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<FailoverGroupInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in 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<FailoverGroupInner> 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)); + } + }); + } + + /** + * Lists the failover groups in 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<FailoverGroupInner> 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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/IdParsingUtils.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..bf89c2d2e0042 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v3_2015_05.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceImpl.java new file mode 100644 index 0000000000000..3f0d770434539 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceImpl.java @@ -0,0 +1,230 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v3_2015_05.ManagedInstance; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.ManagedInstanceUpdate; +import com.microsoft.azure.management.sql.v3_2015_05.ResourceIdentity; +import com.microsoft.azure.management.sql.v3_2015_05.Sku; +import rx.functions.Func1; + +class ManagedInstanceImpl extends GroupableResourceCoreImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { + private ManagedInstanceUpdate updateParameter; + ManagedInstanceImpl(String name, ManagedInstanceInner inner, SqlManager manager) { + super(name, inner, manager); + this.updateParameter = new ManagedInstanceUpdate(); + } + + @Override + public Observable createResourceAsync() { + ManagedInstancesInner client = this.manager().inner().managedInstances(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), 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.name(), 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 client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @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 ResourceIdentity identity() { + return this.inner().identity(); + } + + @Override + public String licenseType() { + return this.inner().licenseType(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @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 Integer vCores() { + return this.inner().vCores(); + } + + @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 withLicenseType(String licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public ManagedInstanceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + 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 withVCores(Integer vCores) { + if (isInCreateMode()) { + this.inner().withVCores(vCores); + } else { + this.updateParameter.withVCores(vCores); + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceInner.java new file mode 100644 index 0000000000000..3f1a485603ed8 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstanceInner.java @@ -0,0 +1,331 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.ResourceIdentity; +import com.microsoft.azure.management.sql.v3_2015_05.Sku; +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. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * 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' and 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * The number of VCores. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * The maximum storage size in GB. + */ + @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; + + /** + * 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. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set managed instance sku. + * + * @param sku the sku value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSku(Sku sku) { + this.sku = sku; + 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' and 'BasePrice'. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the number of VCores. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the number of VCores. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the maximum storage size in GB. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the maximum storage size in GB. + * + * @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; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesImpl.java new file mode 100644 index 0000000000000..d0b950d019e6f --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v3_2015_05.ManagedInstances; +import com.microsoft.azure.management.sql.v3_2015_05.ManagedInstance; +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 ManagedInstancesImpl extends GroupableResourcesCoreImpl implements ManagedInstances { + protected ManagedInstancesImpl(SqlManager manager) { + super(manager.inner().managedInstances(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ManagedInstancesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ManagedInstancesInner 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) { + ManagedInstancesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(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 wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ManagedInstancesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @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 wrapModel(inner); + } + }); + } + + @Override + public ManagedInstanceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ManagedInstanceImpl wrapModel(ManagedInstanceInner inner) { + return new ManagedInstanceImpl(inner.name(), inner, manager()); + } + + @Override + protected ManagedInstanceImpl wrapModel(String name) { + return new ManagedInstanceImpl(name, new ManagedInstanceInner(), this.manager()); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesInner.java new file mode 100644 index 0000000000000..632c4e6a6be54 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ManagedInstancesInner.java @@ -0,0 +1,1145 @@ +/** + * 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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.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.v3_2015_05.ManagedInstances listNext" }) + @GET + Observable> listNext(@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.v3_2015_05.ManagedInstances listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 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. + * + * @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); + } + + /** + * 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); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationImpl.java new file mode 100644 index 0000000000000..1402e1b2cf2ec --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.OperationDisplay; +import com.microsoft.azure.management.sql.v3_2015_05.OperationOrigin; +import java.util.Map; + +class OperationImpl extends WrapperImpl implements Operation { + private final SqlManager manager; + OperationImpl(OperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public OperationOrigin origin() { + return this.inner().origin(); + } + + @Override + public Map properties() { + return this.inner().properties(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationInner.java new file mode 100644 index 0000000000000..5f5afbe3b8d1e --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationInner.java @@ -0,0 +1,82 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.OperationDisplay; +import com.microsoft.azure.management.sql.v3_2015_05.OperationOrigin; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SQL REST API operation definition. + */ +public class OperationInner { + /** + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The localized display information for this particular operation / + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /** + * The intended executor of the operation. Possible values include: 'user', + * 'system'. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /** + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Map properties; + + /** + * Get the name of the operation being performed on this particular object. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the localized display information for this particular operation / action. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the intended executor of the operation. Possible values include: 'user', 'system'. + * + * @return the origin value + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get additional descriptions for the operation. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..e3aae39d6d083 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final SqlManager manager; + + OperationsImpl(SqlManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsInner.java new file mode 100644 index 0000000000000..0467534b6418b --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.v3_2015_05.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.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 Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.Operations list" }) + @GET("providers/Microsoft.Sql/operations") + Observable> list(@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.v3_2015_05.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> 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(); + } + }; + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> 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)); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(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); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> 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(); + } + }; + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @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<OperationInner> 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)); + } + }); + } + + /** + * Lists all of the available SQL Rest API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> 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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/PageImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/PageImpl.java new file mode 100644 index 0000000000000..082671149e09f --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2015_05.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerImpl.java new file mode 100644 index 0000000000000..663e5f0652845 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v3_2015_05.Server; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.ServerUpdate; +import com.microsoft.azure.management.sql.v3_2015_05.ResourceIdentity; +import rx.functions.Func1; + +class ServerImpl extends GroupableResourceCoreImpl implements Server, Server.Definition, Server.Update { + private ServerUpdate updateParameter; + ServerImpl(String name, ServerInner inner, SqlManager manager) { + super(name, inner, manager); + this.updateParameter = new ServerUpdate(); + } + + @Override + public Observable createResourceAsync() { + ServersInner client = this.manager().inner().servers(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ServerInner call(ServerInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServersInner client = this.manager().inner().servers(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ServerInner call(ServerInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServersInner client = this.manager().inner().servers(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ServerUpdate(); + } + + @Override + public String administratorLogin() { + return this.inner().administratorLogin(); + } + + @Override + public String administratorLoginPassword() { + return this.inner().administratorLoginPassword(); + } + + @Override + public String fullyQualifiedDomainName() { + return this.inner().fullyQualifiedDomainName(); + } + + @Override + public ResourceIdentity identity() { + return this.inner().identity(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String version() { + return this.inner().version(); + } + + @Override + public ServerImpl withIdentity(ResourceIdentity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public ServerImpl withAdministratorLogin(String administratorLogin) { + if (isInCreateMode()) { + this.inner().withAdministratorLogin(administratorLogin); + } else { + this.updateParameter.withAdministratorLogin(administratorLogin); + } + return this; + } + + @Override + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.inner().withAdministratorLoginPassword(administratorLoginPassword); + } else { + this.updateParameter.withAdministratorLoginPassword(administratorLoginPassword); + } + return this; + } + + @Override + public ServerImpl withVersion(String version) { + if (isInCreateMode()) { + this.inner().withVersion(version); + } else { + this.updateParameter.withVersion(version); + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerInner.java new file mode 100644 index 0000000000000..64c3684f85245 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerInner.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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.ResourceIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL Database server. + */ +@JsonFlatten +public class ServerInner extends Resource { + /** + * The Azure Active Directory identity of the server. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /** + * Kind of sql server. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The version of the server. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * The state of the server. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Get the Azure Active Directory identity of the server. + * + * @return the identity value + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the Azure Active Directory identity of the server. + * + * @param identity the identity value to set + * @return the ServerInner object itself. + */ + public ServerInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get kind of sql server. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set administrator username for the server. Once created it cannot be changed. + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administrator login password (required for server creation). + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version of the server. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version of the server. + * + * @param version the version value to set + * @return the ServerInner object itself. + */ + public ServerInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state of the server. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyImpl.java new file mode 100644 index 0000000000000..fb47bbd16425c --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyImpl.java @@ -0,0 +1,161 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.ServerKey; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.ServerKeyType; +import org.joda.time.DateTime; + +class ServerKeyImpl extends CreatableUpdatableImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String keyName; + + ServerKeyImpl(String name, SqlManager manager) { + super(name, new ServerKeyInner()); + this.manager = manager; + // Set resource name + this.keyName = name; + // + } + + ServerKeyImpl(ServerKeyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.keyName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.keyName = IdParsingUtils.getValueFromIdByName(inner.id(), "keys"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerKeysInner client = this.manager().inner().serverKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerKeysInner client = this.manager().inner().serverKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerKeysInner client = this.manager().inner().serverKeys(); + return client.getAsync(this.resourceGroupName, this.serverName, this.keyName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String subregion() { + return this.inner().subregion(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + + @Override + public ServerKeyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.inner().withServerKeyType(serverKeyType); + return this; + } + + @Override + public ServerKeyImpl withCreationDate(DateTime creationDate) { + this.inner().withCreationDate(creationDate); + return this; + } + + @Override + public ServerKeyImpl withKind(String kind) { + this.inner().withKind(kind); + return this; + } + + @Override + public ServerKeyImpl withThumbprint(String thumbprint) { + this.inner().withThumbprint(thumbprint); + return this; + } + + @Override + public ServerKeyImpl withUri(String uri) { + this.inner().withUri(uri); + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyInner.java new file mode 100644 index 0000000000000..01acbc5ea348d --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeyInner.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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.ServerKeyType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server key. + */ +@JsonFlatten +public class ServerKeyInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Subregion of the server key. + */ + @JsonProperty(value = "properties.subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /** + * The server key type like 'ServiceManaged', 'AzureKeyVault'. Possible + * values include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /** + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint") + private String thumbprint; + + /** + * The server key creation date. + */ + @JsonProperty(value = "properties.creationDate") + private DateTime creationDate; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Set kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @param kind the kind value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get subregion of the server key. + * + * @return the subregion value + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the server key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the server key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the server key. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the server key. + * + * @param uri the uri value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get thumbprint of the server key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set thumbprint of the server key. + * + * @param thumbprint the thumbprint value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the server key creation date. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Set the server key creation date. + * + * @param creationDate the creationDate value to set + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withCreationDate(DateTime creationDate) { + this.creationDate = creationDate; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysImpl.java new file mode 100644 index 0000000000000..c7753297ba595 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.ServerKeys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.ServerKey; + +class ServerKeysImpl extends WrapperImpl implements ServerKeys { + private final SqlManager manager; + + ServerKeysImpl(SqlManager manager) { + super(manager.inner().serverKeys()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerKeyImpl define(String name) { + return wrapModel(name); + } + + private ServerKeyImpl wrapModel(ServerKeyInner inner) { + return new ServerKeyImpl(inner, manager()); + } + + private ServerKeyImpl wrapModel(String name) { + return new ServerKeyImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerKeysInner 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 ServerKey call(ServerKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String keyName) { + ServerKeysInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, keyName) + .map(new Func1() { + @Override + public ServerKey call(ServerKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String keyName) { + ServerKeysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, keyName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysInner.java new file mode 100644 index 0000000000000..a56e3a1573001 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServerKeysInner.java @@ -0,0 +1,777 @@ +/** + * 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.v3_2015_05.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 ServerKeys. + */ +public class ServerKeysInner { + /** The Retrofit service to perform REST calls. */ + private ServerKeysService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerKeysInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.ServerKeys listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys") + 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.v3_2015_05.ServerKeys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @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.v3_2015_05.ServerKeys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ServerKeyInner 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.v3_2015_05.ServerKeys beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ServerKeyInner 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.v3_2015_05.ServerKeys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @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.v3_2015_05.ServerKeys beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("keyName") String keyName, @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.v3_2015_05.ServerKeys listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of server keys. + * + * @param resourceGroupName The 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<ServerKeyInner> 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 keys. + * + * @param resourceGroupName The 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 keys. + * + * @param resourceGroupName The 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<ServerKeyInner> 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 keys. + * + * @param resourceGroupName The 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<ServerKeyInner> 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 keys. + * + 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<ServerKeyInner> 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 a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key 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 ServerKeyInner object if successful. + */ + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, keyName).toBlocking().single().body(); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key 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 getAsync(String resourceGroupName, String serverName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, keyName), serviceCallback); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, keyName).map(new Func1, ServerKeyInner>() { + @Override + public ServerKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 ServerKeyInner object if successful. + */ + public ServerKeyInner createOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 serverName, String keyName, ServerKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).map(new Func1, ServerKeyInner>() { + @Override + public ServerKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 ServerKeyInner object if successful. + */ + public ServerKeyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key 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 serverName, String keyName, ServerKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).map(new Func1, ServerKeyInner>() { + @Override + public ServerKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server key. + * + * @param resourceGroupName The 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 keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerKeyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 the server key with the 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 keyName The name of the server key 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 serverName, String keyName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).toBlocking().last().body(); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key 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 serverName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, keyName), serviceCallback); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String keyName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key 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 serverName, String keyName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).toBlocking().single().body(); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key 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 serverName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, keyName), serviceCallback); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String keyName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server key with the 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 keyName The name of the server key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 a list of server keys. + * + * @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<ServerKeyInner> 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 keys. + * + * @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 keys. + * + * @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<ServerKeyInner> 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 keys. + * + * @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<ServerKeyInner> 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 keys. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerKeyInner> 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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersImpl.java new file mode 100644 index 0000000000000..740cfbb314cf5 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v3_2015_05.Servers; +import com.microsoft.azure.management.sql.v3_2015_05.Server; +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 ServersImpl extends GroupableResourcesCoreImpl implements Servers { + protected ServersImpl(SqlManager manager) { + super(manager.inner().servers(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ServersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ServersInner 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) { + ServersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ServersInner 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 Server call(ServerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ServersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ServersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Server call(ServerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ServerImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ServerImpl wrapModel(ServerInner inner) { + return new ServerImpl(inner.name(), inner, manager()); + } + + @Override + protected ServerImpl wrapModel(String name) { + return new ServerImpl(name, new ServerInner(), this.manager()); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersInner.java new file mode 100644 index 0000000000000..83e5fe5d80fb5 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/ServersInner.java @@ -0,0 +1,1145 @@ +/** + * 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.v3_2015_05.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.v3_2015_05.ServerUpdate; +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 Servers. + */ +public class ServersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ServersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Servers to be + * used by Retrofit to perform actually REST calls. + */ + interface ServersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.Servers list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers") + 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.v3_2015_05.Servers listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers") + 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.v3_2015_05.Servers getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> getByResourceGroup(@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.v3_2015_05.Servers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerInner 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.v3_2015_05.Servers beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerInner 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.v3_2015_05.Servers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v3_2015_05.Servers beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v3_2015_05.Servers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdate 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.v3_2015_05.Servers beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdate 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.v3_2015_05.Servers listNext" }) + @GET + Observable> listNext(@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.v3_2015_05.Servers listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of all servers 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<ServerInner> 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 servers 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 servers in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all servers in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerInner> 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 servers in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerInner> 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 servers in a resource groups. + * + * @param resourceGroupName 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<ServerInner> 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 servers in a resource groups. + * + * @param resourceGroupName The 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 servers in a resource groups. + * + * @param resourceGroupName 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<ServerInner> 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 servers in a resource groups. + * + * @param resourceGroupName 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<ServerInner> 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 servers in a resource groups. + * + 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<ServerInner> 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 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 ServerInner object if successful. + */ + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets 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 getByResourceGroupAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets 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 ServerInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 ServerInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, 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.getByResourceGroup(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 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 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates 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 parameters The requested server 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 serverName, ServerInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerInner 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 (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, 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 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates 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 parameters The requested server 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 serverName, ServerInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerInner 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 (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, 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 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 + */ + public void delete(String resourceGroupName, String serverName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().last().body(); + } + + /** + * Deletes 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 deleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes 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 + */ + 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 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 + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, 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."); + } + Observable> observable = service.delete(resourceGroupName, serverName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes 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 + */ + public void beginDelete(String resourceGroupName, String serverName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Deletes 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 beginDeleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes 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 {@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 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 {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, 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.beginDelete(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 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 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Updates 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 parameters The requested server 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 serverName, ServerUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdate 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 (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, serverName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates 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 parameters The requested server 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 ServerInner object if successful. + */ + public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Updates 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 parameters The requested server 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 serverName, ServerUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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 parameters The requested server resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdate 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 (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, serverName, 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 servers 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<ServerInner> 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 servers 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 servers 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<ServerInner> 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 servers 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<ServerInner> 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 servers 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<ServerInner> 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); + } + + /** + * Gets a list of servers in a resource groups. + * + * @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<ServerInner> 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 servers in a resource groups. + * + * @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 servers in a resource groups. + * + * @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<ServerInner> 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 servers in a resource groups. + * + * @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<ServerInner> 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 servers in a resource groups. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerInner> 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); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..8693b173a481d --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManagementClientImpl.java @@ -0,0 +1,350 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DatabaseAutomaticTuningsInner object to access its operations. + */ + private DatabaseAutomaticTuningsInner databaseAutomaticTunings; + + /** + * Gets the DatabaseAutomaticTuningsInner object to access its operations. + * @return the DatabaseAutomaticTuningsInner object. + */ + public DatabaseAutomaticTuningsInner databaseAutomaticTunings() { + return this.databaseAutomaticTunings; + } + + /** + * The EncryptionProtectorsInner object to access its operations. + */ + private EncryptionProtectorsInner encryptionProtectors; + + /** + * Gets the EncryptionProtectorsInner object to access its operations. + * @return the EncryptionProtectorsInner object. + */ + public EncryptionProtectorsInner encryptionProtectors() { + return this.encryptionProtectors; + } + + /** + * The FailoverGroupsInner object to access its operations. + */ + private FailoverGroupsInner failoverGroups; + + /** + * Gets the FailoverGroupsInner object to access its operations. + * @return the FailoverGroupsInner object. + */ + public FailoverGroupsInner failoverGroups() { + return this.failoverGroups; + } + + /** + * 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 OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The ServerKeysInner object to access its operations. + */ + private ServerKeysInner serverKeys; + + /** + * Gets the ServerKeysInner object to access its operations. + * @return the ServerKeysInner object. + */ + public ServerKeysInner serverKeys() { + return this.serverKeys; + } + + /** + * The ServersInner object to access its operations. + */ + private ServersInner servers; + + /** + * Gets the ServersInner object to access its operations. + * @return the ServersInner object. + */ + public ServersInner servers() { + return this.servers; + } + + /** + * The SyncAgentsInner object to access its operations. + */ + private SyncAgentsInner syncAgents; + + /** + * Gets the SyncAgentsInner object to access its operations. + * @return the SyncAgentsInner object. + */ + public SyncAgentsInner syncAgents() { + return this.syncAgents; + } + + /** + * The SyncGroupsInner object to access its operations. + */ + private SyncGroupsInner syncGroups; + + /** + * Gets the SyncGroupsInner object to access its operations. + * @return the SyncGroupsInner object. + */ + public SyncGroupsInner syncGroups() { + return this.syncGroups; + } + + /** + * The SyncMembersInner object to access its operations. + */ + private SyncMembersInner syncMembers; + + /** + * Gets the SyncMembersInner object to access its operations. + * @return the SyncMembersInner object. + */ + public SyncMembersInner syncMembers() { + return this.syncMembers; + } + + /** + * The SubscriptionUsagesInner object to access its operations. + */ + private SubscriptionUsagesInner subscriptionUsages; + + /** + * Gets the SubscriptionUsagesInner object to access its operations. + * @return the SubscriptionUsagesInner object. + */ + public SubscriptionUsagesInner subscriptionUsages() { + return this.subscriptionUsages; + } + + /** + * The VirtualNetworkRulesInner object to access its operations. + */ + private VirtualNetworkRulesInner virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesInner object to access its operations. + * @return the VirtualNetworkRulesInner object. + */ + public VirtualNetworkRulesInner virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-05-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.databaseAutomaticTunings = new DatabaseAutomaticTuningsInner(restClient().retrofit(), this); + this.encryptionProtectors = new EncryptionProtectorsInner(restClient().retrofit(), this); + this.failoverGroups = new FailoverGroupsInner(restClient().retrofit(), this); + this.managedInstances = new ManagedInstancesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.serverKeys = new ServerKeysInner(restClient().retrofit(), this); + this.servers = new ServersInner(restClient().retrofit(), this); + this.syncAgents = new SyncAgentsInner(restClient().retrofit(), this); + this.syncGroups = new SyncGroupsInner(restClient().retrofit(), this); + this.syncMembers = new SyncMembersInner(restClient().retrofit(), this); + this.subscriptionUsages = new SubscriptionUsagesInner(restClient().retrofit(), this); + this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2015-05-01-preview"); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManager.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManager.java new file mode 100644 index 0000000000000..5ce30ba703572 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SqlManager.java @@ -0,0 +1,231 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v3_2015_05.DatabaseAutomaticTunings; +import com.microsoft.azure.management.sql.v3_2015_05.EncryptionProtectors; +import com.microsoft.azure.management.sql.v3_2015_05.FailoverGroups; +import com.microsoft.azure.management.sql.v3_2015_05.ManagedInstances; +import com.microsoft.azure.management.sql.v3_2015_05.Operations; +import com.microsoft.azure.management.sql.v3_2015_05.ServerKeys; +import com.microsoft.azure.management.sql.v3_2015_05.Servers; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgents; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroups; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMembers; +import com.microsoft.azure.management.sql.v3_2015_05.SubscriptionUsages; +import com.microsoft.azure.management.sql.v3_2015_05.VirtualNetworkRules; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private DatabaseAutomaticTunings databaseAutomaticTunings; + private EncryptionProtectors encryptionProtectors; + private FailoverGroups failoverGroups; + private ManagedInstances managedInstances; + private Operations operations; + private ServerKeys serverKeys; + private Servers servers; + private SyncAgents syncAgents; + private SyncGroups syncGroups; + private SyncMembers syncMembers; + private SubscriptionUsages subscriptionUsages; + private VirtualNetworkRules virtualNetworkRules; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DatabaseAutomaticTunings. + */ + public DatabaseAutomaticTunings databaseAutomaticTunings() { + if (this.databaseAutomaticTunings == null) { + this.databaseAutomaticTunings = new DatabaseAutomaticTuningsImpl(this); + } + return this.databaseAutomaticTunings; + } + + /** + * @return Entry point to manage EncryptionProtectors. + */ + public EncryptionProtectors encryptionProtectors() { + if (this.encryptionProtectors == null) { + this.encryptionProtectors = new EncryptionProtectorsImpl(this); + } + return this.encryptionProtectors; + } + + /** + * @return Entry point to manage FailoverGroups. + */ + public FailoverGroups failoverGroups() { + if (this.failoverGroups == null) { + this.failoverGroups = new FailoverGroupsImpl(this); + } + return this.failoverGroups; + } + + /** + * @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 Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage ServerKeys. + */ + public ServerKeys serverKeys() { + if (this.serverKeys == null) { + this.serverKeys = new ServerKeysImpl(this); + } + return this.serverKeys; + } + + /** + * @return Entry point to manage Servers. + */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(this); + } + return this.servers; + } + + /** + * @return Entry point to manage SyncAgents. + */ + public SyncAgents syncAgents() { + if (this.syncAgents == null) { + this.syncAgents = new SyncAgentsImpl(this); + } + return this.syncAgents; + } + + /** + * @return Entry point to manage SyncGroups. + */ + public SyncGroups syncGroups() { + if (this.syncGroups == null) { + this.syncGroups = new SyncGroupsImpl(this); + } + return this.syncGroups; + } + + /** + * @return Entry point to manage SyncMembers. + */ + public SyncMembers syncMembers() { + if (this.syncMembers == null) { + this.syncMembers = new SyncMembersImpl(this); + } + return this.syncMembers; + } + + /** + * @return Entry point to manage SubscriptionUsages. + */ + public SubscriptionUsages subscriptionUsages() { + if (this.subscriptionUsages == null) { + this.subscriptionUsages = new SubscriptionUsagesImpl(this); + } + return this.subscriptionUsages; + } + + /** + * @return Entry point to manage VirtualNetworkRules. + */ + public VirtualNetworkRules virtualNetworkRules() { + if (this.virtualNetworkRules == null) { + this.virtualNetworkRules = new VirtualNetworkRulesImpl(this); + } + return this.virtualNetworkRules; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageImpl.java new file mode 100644 index 0000000000000..bac6ade0e1f16 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SubscriptionUsage; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class SubscriptionUsageImpl extends IndexableRefreshableWrapperImpl implements SubscriptionUsage { + private final SqlManager manager; + private String locationName; + private String usageName; + + SubscriptionUsageImpl(SubscriptionUsageInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.usageName = IdParsingUtils.getValueFromIdByName(inner.id(), "usages"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + SubscriptionUsagesInner client = this.manager().inner().subscriptionUsages(); + return client.getAsync(this.locationName, this.usageName); + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageInner.java new file mode 100644 index 0000000000000..4b5662d57691b --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsageInner.java @@ -0,0 +1,80 @@ +/** + * 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.v3_2015_05.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Usage Metric of a Subscription in a Location. + */ +@JsonFlatten +public class SubscriptionUsageInner extends ProxyResource { + /** + * User-readable name of the metric. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Current value of the metric. + */ + @JsonProperty(value = "properties.currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /** + * Boundary value of the metric. + */ + @JsonProperty(value = "properties.limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit of the metric. + */ + @JsonProperty(value = "properties.unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Get user-readable name of the metric. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get current value of the metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get boundary value of the metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit of the metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesImpl.java new file mode 100644 index 0000000000000..398e4d64b5b4b --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesImpl.java @@ -0,0 +1,72 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.SubscriptionUsages; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2015_05.SubscriptionUsage; +import com.microsoft.azure.Page; + +class SubscriptionUsagesImpl extends WrapperImpl implements SubscriptionUsages { + private final SqlManager manager; + + SubscriptionUsagesImpl(SqlManager manager) { + super(manager.inner().subscriptionUsages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private SubscriptionUsageImpl wrapSubscriptionUsageModel(SubscriptionUsageInner inner) { + return new SubscriptionUsageImpl(inner, manager()); + } + + private Observable getSubscriptionUsageInnerUsingSubscriptionUsagesInnerAsync(String id) { + String locationName = IdParsingUtils.getValueFromIdByName(id, "locations"); + String usageName = IdParsingUtils.getValueFromIdByName(id, "usages"); + SubscriptionUsagesInner client = this.inner(); + return client.getAsync(locationName, usageName); + } + + @Override + public Observable getAsync(String locationName, String usageName) { + SubscriptionUsagesInner client = this.inner(); + return client.getAsync(locationName, usageName) + .map(new Func1() { + @Override + public SubscriptionUsage call(SubscriptionUsageInner inner) { + return wrapSubscriptionUsageModel(inner); + } + }); + } + + @Override + public Observable listByLocationAsync(final String locationName) { + SubscriptionUsagesInner 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 SubscriptionUsage call(SubscriptionUsageInner inner) { + return wrapSubscriptionUsageModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesInner.java new file mode 100644 index 0000000000000..39e505b277b1d --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SubscriptionUsagesInner.java @@ -0,0 +1,386 @@ +/** + * 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.v3_2015_05.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 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 SubscriptionUsages. + */ +public class SubscriptionUsagesInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionUsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SubscriptionUsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionUsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SubscriptionUsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for SubscriptionUsages to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionUsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.SubscriptionUsages listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages") + Observable> listByLocation(@Path("locationName") String locationName, @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.v3_2015_05.SubscriptionUsages get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}") + Observable> get(@Path("locationName") String locationName, @Path("usageName") String usageName, @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.v3_2015_05.SubscriptionUsages listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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<SubscriptionUsageInner> 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(); + } + }; + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @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); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionUsageInner> object + */ + public Observable> listByLocationAsync(final String locationName) { + return listByLocationWithServiceResponseAsync(locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionUsageInner> 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)); + } + }); + } + + /** + * Gets all subscription usage metrics in a given location. + * + ServiceResponse> * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionUsageInner> 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."); + } + return service.listByLocation(locationName, 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 = 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 subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 SubscriptionUsageInner object if successful. + */ + public SubscriptionUsageInner get(String locationName, String usageName) { + return getWithServiceResponseAsync(locationName, usageName).toBlocking().single().body(); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @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 usageName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, usageName), serviceCallback); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionUsageInner object + */ + public Observable getAsync(String locationName, String usageName) { + return getWithServiceResponseAsync(locationName, usageName).map(new Func1, SubscriptionUsageInner>() { + @Override + public SubscriptionUsageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a subscription usage metric. + * + * @param locationName The name of the region where the resource is located. + * @param usageName Name of usage metric to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionUsageInner object + */ + public Observable> getWithServiceResponseAsync(String locationName, String usageName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (usageName == null) { + throw new IllegalArgumentException("Parameter usageName 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, usageName, 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 all subscription usage metrics 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<SubscriptionUsageInner> 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(); + } + }; + } + + /** + * Gets all subscription usage metrics 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); + } + + /** + * Gets all subscription usage metrics 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<SubscriptionUsageInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscription usage metrics 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<SubscriptionUsageInner> 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)); + } + }); + } + + /** + * Gets all subscription usage metrics 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<SubscriptionUsageInner> 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); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentImpl.java new file mode 100644 index 0000000000000..d0f0b6730bdee --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentImpl.java @@ -0,0 +1,131 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgent; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgentState; + +class SyncAgentImpl extends CreatableUpdatableImpl implements SyncAgent, SyncAgent.Definition, SyncAgent.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String syncAgentName; + + SyncAgentImpl(String name, SqlManager manager) { + super(name, new SyncAgentInner()); + this.manager = manager; + // Set resource name + this.syncAgentName = name; + // + } + + SyncAgentImpl(SyncAgentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.syncAgentName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.syncAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncAgents"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SyncAgentsInner client = this.manager().inner().syncAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.syncAgentName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SyncAgentsInner client = this.manager().inner().syncAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.syncAgentName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SyncAgentsInner client = this.manager().inner().syncAgents(); + return client.getAsync(this.resourceGroupName, this.serverName, this.syncAgentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime expiryTime() { + return this.inner().expiryTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isUpToDate() { + return this.inner().isUpToDate(); + } + + @Override + public DateTime lastAliveTime() { + return this.inner().lastAliveTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SyncAgentState state() { + return this.inner().state(); + } + + @Override + public String syncAgentName() { + return this.inner().syncAgentName(); + } + + @Override + public String syncDatabaseId() { + return this.inner().syncDatabaseId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String version() { + return this.inner().version(); + } + + @Override + public SyncAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentInner.java new file mode 100644 index 0000000000000..9f653c0fa51a9 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentInner.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.v3_2015_05.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync agent. + */ +@JsonFlatten +public class SyncAgentInner extends ProxyResource { + /** + * Name of the sync agent. + */ + @JsonProperty(value = "properties.name", access = JsonProperty.Access.WRITE_ONLY) + private String syncAgentName; + + /** + * ARM resource id of the sync database in the sync agent. + */ + @JsonProperty(value = "properties.syncDatabaseId") + private String syncDatabaseId; + + /** + * Last alive time of the sync agent. + */ + @JsonProperty(value = "properties.lastAliveTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastAliveTime; + + /** + * State of the sync agent. Possible values include: 'Online', 'Offline', + * 'NeverConnected'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private SyncAgentState state; + + /** + * If the sync agent version is up to date. + */ + @JsonProperty(value = "properties.isUpToDate", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUpToDate; + + /** + * Expiration time of the sync agent version. + */ + @JsonProperty(value = "properties.expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiryTime; + + /** + * Version of the sync agent. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get name of the sync agent. + * + * @return the syncAgentName value + */ + public String syncAgentName() { + return this.syncAgentName; + } + + /** + * Get aRM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set aRM resource id of the sync database in the sync agent. + * + * @param syncDatabaseId the syncDatabaseId value to set + * @return the SyncAgentInner object itself. + */ + public SyncAgentInner withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get last alive time of the sync agent. + * + * @return the lastAliveTime value + */ + public DateTime lastAliveTime() { + return this.lastAliveTime; + } + + /** + * Get state of the sync agent. Possible values include: 'Online', 'Offline', 'NeverConnected'. + * + * @return the state value + */ + public SyncAgentState state() { + return this.state; + } + + /** + * Get if the sync agent version is up to date. + * + * @return the isUpToDate value + */ + public Boolean isUpToDate() { + return this.isUpToDate; + } + + /** + * Get expiration time of the sync agent version. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get version of the sync agent. + * + * @return the version value + */ + public String version() { + return this.version; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesImpl.java new file mode 100644 index 0000000000000..16e62276756fa --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesImpl.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgentKeyProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class SyncAgentKeyPropertiesImpl extends WrapperImpl implements SyncAgentKeyProperties { + private final SqlManager manager; + SyncAgentKeyPropertiesImpl(SyncAgentKeyPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String syncAgentKey() { + return this.inner().syncAgentKey(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesInner.java new file mode 100644 index 0000000000000..73e56f5824402 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentKeyPropertiesInner.java @@ -0,0 +1,32 @@ +/** + * 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.v3_2015_05.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an Azure SQL Database sync agent key. + */ +public class SyncAgentKeyPropertiesInner { + /** + * Key of sync agent. + */ + @JsonProperty(value = "syncAgentKey", access = JsonProperty.Access.WRITE_ONLY) + private String syncAgentKey; + + /** + * Get key of sync agent. + * + * @return the syncAgentKey value + */ + public String syncAgentKey() { + return this.syncAgentKey; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseImpl.java new file mode 100644 index 0000000000000..ded3f3809027c --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgentLinkedDatabase; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberDbType; + +class SyncAgentLinkedDatabaseImpl extends WrapperImpl implements SyncAgentLinkedDatabase { + private final SqlManager manager; + + SyncAgentLinkedDatabaseImpl(SyncAgentLinkedDatabaseInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String databaseId() { + return this.inner().databaseId(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public SyncMemberDbType databaseType() { + return this.inner().databaseType(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userName() { + return this.inner().userName(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseInner.java new file mode 100644 index 0000000000000..54f9dc7f1ef90 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentLinkedDatabaseInner.java @@ -0,0 +1,112 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberDbType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync agent linked database. + */ +@JsonFlatten +public class SyncAgentLinkedDatabaseInner extends ProxyResource { + /** + * Type of the sync agent linked database. Possible values include: + * 'AzureSqlDatabase', 'SqlServerDatabase'. + */ + @JsonProperty(value = "properties.databaseType", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberDbType databaseType; + + /** + * Id of the sync agent linked database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private String databaseId; + + /** + * Description of the sync agent linked database. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Server name of the sync agent linked database. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * Database name of the sync agent linked database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * User name of the sync agent linked database. + */ + @JsonProperty(value = "properties.userName", access = JsonProperty.Access.WRITE_ONLY) + private String userName; + + /** + * Get type of the sync agent linked database. Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase'. + * + * @return the databaseType value + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Get id of the sync agent linked database. + * + * @return the databaseId value + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Get description of the sync agent linked database. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get server name of the sync agent linked database. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get database name of the sync agent linked database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get user name of the sync agent linked database. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsImpl.java new file mode 100644 index 0000000000000..44e6f4e899f25 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgents; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgentKeyProperties; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgent; +import com.microsoft.azure.management.sql.v3_2015_05.SyncAgentLinkedDatabase; + +class SyncAgentsImpl extends WrapperImpl implements SyncAgents { + private final SqlManager manager; + + SyncAgentsImpl(SqlManager manager) { + super(manager.inner().syncAgents()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SyncAgentImpl define(String name) { + return wrapModel(name); + } + + private SyncAgentImpl wrapModel(SyncAgentInner inner) { + return new SyncAgentImpl(inner, manager()); + } + + private SyncAgentImpl wrapModel(String name) { + return new SyncAgentImpl(name, this.manager()); + } + + @Override + public Observable generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.generateKeyAsync(resourceGroupName, serverName, syncAgentName) + .map(new Func1() { + @Override + public SyncAgentKeyProperties call(SyncAgentKeyPropertiesInner inner) { + return new SyncAgentKeyPropertiesImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + SyncAgentsInner 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 SyncAgent call(SyncAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, syncAgentName) + .map(new Func1() { + @Override + public SyncAgent call(SyncAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, syncAgentName).toCompletable(); + } + + private SyncAgentLinkedDatabaseImpl wrapSyncAgentLinkedDatabaseModel(SyncAgentLinkedDatabaseInner inner) { + return new SyncAgentLinkedDatabaseImpl(inner, manager()); + } + + @Override + public Observable listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + SyncAgentsInner client = this.inner(); + return client.listLinkedDatabasesAsync(resourceGroupName, serverName, syncAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncAgentLinkedDatabase call(SyncAgentLinkedDatabaseInner inner) { + return wrapSyncAgentLinkedDatabaseModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsInner.java new file mode 100644 index 0000000000000..b18f904b4eb23 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncAgentsInner.java @@ -0,0 +1,1287 @@ +/** + * 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.v3_2015_05.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 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 SyncAgents. + */ +public class SyncAgentsInner { + /** The Retrofit service to perform REST calls. */ + private SyncAgentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncAgentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SyncAgentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SyncAgentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SyncAgents to be + * used by Retrofit to perform actually REST calls. + */ + interface SyncAgentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.SyncAgents get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v3_2015_05.SyncAgents createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SyncAgentInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.SyncAgents beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SyncAgentInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.SyncAgents delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v3_2015_05.SyncAgents beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v3_2015_05.SyncAgents listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents") + 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.v3_2015_05.SyncAgents generateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/generateKey") + Observable> generateKey(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v3_2015_05.SyncAgents listLinkedDatabases" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/linkedDatabases") + Observable> listLinkedDatabases(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("syncAgentName") String syncAgentName, @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.v3_2015_05.SyncAgents listByServerNext" }) + @GET + Observable> listByServerNext(@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.v3_2015_05.SyncAgents listLinkedDatabasesNext" }) + @GET + Observable> listLinkedDatabasesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner get(String resourceGroupName, String serverName, String syncAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String syncAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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, syncAgentName, 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 sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner createOrUpdate(String resourceGroupName, String serverName, String syncAgentName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().last().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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 syncDatabaseId = null; + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(null); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner createOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().last().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 syncAgentName, String syncDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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."); + } + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(syncDatabaseId); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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 syncDatabaseId = null; + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(null); + return service.beginCreateOrUpdate(resourceGroupName, serverName, syncAgentName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 SyncAgentInner object if successful. + */ + public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().single().body(); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @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 syncAgentName, String syncDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId), serviceCallback); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).map(new Func1, SyncAgentInner>() { + @Override + public SyncAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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."); + } + SyncAgentInner parameters = new SyncAgentInner(); + parameters.withSyncDatabaseId(syncDatabaseId); + return service.beginCreateOrUpdate(resourceGroupName, serverName, syncAgentName, 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 = 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 sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().last().body(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String syncAgentName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String syncAgentName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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, syncAgentName, 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); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @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<SyncAgentInner> 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(); + } + }; + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @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); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentInner> 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(); + } + }); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentInner> 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)); + } + }); + } + + /** + * Lists sync agents in 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 on which the sync agent is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncAgentInner> 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); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 SyncAgentKeyPropertiesInner object if successful. + */ + public SyncAgentKeyPropertiesInner generateKey(String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single().body(); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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 generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName), serviceCallback); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentKeyPropertiesInner object + */ + public Observable generateKeyAsync(String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1, SyncAgentKeyPropertiesInner>() { + @Override + public SyncAgentKeyPropertiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Generates a sync agent key. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncAgentKeyPropertiesInner object + */ + public Observable> generateKeyWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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.generateKey(resourceGroupName, serverName, syncAgentName, 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 = generateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateKeyDelegate(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); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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<SyncAgentLinkedDatabaseInner> object if successful. + */ + public PagedList listLinkedDatabases(final String resourceGroupName, final String serverName, final String syncAgentName) { + ServiceResponse> response = listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @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> listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentLinkedDatabaseInner> object + */ + public Observable> listLinkedDatabasesAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + return listLinkedDatabasesWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + * @param resourceGroupName The 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 on which the sync agent is hosted. + * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncAgentLinkedDatabaseInner> object + */ + public Observable>> listLinkedDatabasesWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + return listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName) + .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(listLinkedDatabasesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + 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 on which the sync agent is hosted. + ServiceResponse> * @param syncAgentName The name of the sync agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncAgentLinkedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLinkedDatabasesSinglePageAsync(final String resourceGroupName, final String serverName, final String syncAgentName) { + 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 (syncAgentName == null) { + throw new IllegalArgumentException("Parameter syncAgentName 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.listLinkedDatabases(resourceGroupName, serverName, syncAgentName, 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 = listLinkedDatabasesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLinkedDatabasesDelegate(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 sync agents in 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<SyncAgentInner> 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(); + } + }; + } + + /** + * Lists sync agents in 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); + } + + /** + * Lists sync agents in 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<SyncAgentInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync agents in 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<SyncAgentInner> 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)); + } + }); + } + + /** + * Lists sync agents in 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<SyncAgentInner> 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); + } + + /** + * Lists databases linked to a sync agent. + * + * @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<SyncAgentLinkedDatabaseInner> object if successful. + */ + public PagedList listLinkedDatabasesNext(final String nextPageLink) { + ServiceResponse> response = listLinkedDatabasesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists databases linked to a sync agent. + * + * @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> listLinkedDatabasesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLinkedDatabasesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists databases linked to a sync agent. + * + * @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<SyncAgentLinkedDatabaseInner> object + */ + public Observable> listLinkedDatabasesNextAsync(final String nextPageLink) { + return listLinkedDatabasesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + * @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<SyncAgentLinkedDatabaseInner> object + */ + public Observable>> listLinkedDatabasesNextWithServiceResponseAsync(final String nextPageLink) { + return listLinkedDatabasesNextSinglePageAsync(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(listLinkedDatabasesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists databases linked to a sync agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncAgentLinkedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLinkedDatabasesNextSinglePageAsync(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.listLinkedDatabasesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLinkedDatabasesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLinkedDatabasesNextDelegate(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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesImpl.java new file mode 100644 index 0000000000000..ab8fa7db52b0a --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesImpl.java @@ -0,0 +1,35 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncDatabaseIdProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class SyncDatabaseIdPropertiesImpl extends WrapperImpl implements SyncDatabaseIdProperties { + private final SqlManager manager; + + SyncDatabaseIdPropertiesImpl(SyncDatabaseIdPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesInner.java new file mode 100644 index 0000000000000..f3a418eade291 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncDatabaseIdPropertiesInner.java @@ -0,0 +1,32 @@ +/** + * 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.v3_2015_05.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the sync database id. + */ +public class SyncDatabaseIdPropertiesInner { + /** + * ARM resource id of sync database. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get aRM resource id of sync database. + * + * @return the id value + */ + public String id() { + return this.id; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncFullSchemaPropertiesInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncFullSchemaPropertiesInner.java new file mode 100644 index 0000000000000..556efd6d981e7 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncFullSchemaPropertiesInner.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.v3_2015_05.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v3_2015_05.SyncFullSchemaTable; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the database full schema. + */ +public class SyncFullSchemaPropertiesInner { + /** + * List of tables in the database full schema. + */ + @JsonProperty(value = "tables", access = JsonProperty.Access.WRITE_ONLY) + private List tables; + + /** + * Last update time of the database schema. + */ + @JsonProperty(value = "lastUpdateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdateTime; + + /** + * Get list of tables in the database full schema. + * + * @return the tables value + */ + public List tables() { + return this.tables; + } + + /** + * Get last update time of the database schema. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java new file mode 100644 index 0000000000000..7ea39e59e6d79 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2015_05.SyncFullSchemaTable; + +class SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl extends WrapperImpl implements SyncGroupDatabasisServerSyncFullSchemaProperties { + private final SqlManager manager; + + SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(SyncFullSchemaPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime lastUpdateTime() { + return this.inner().lastUpdateTime(); + } + + @Override + public List tables() { + return this.inner().tables(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupImpl.java new file mode 100644 index 0000000000000..aabfb479589d7 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupImpl.java @@ -0,0 +1,177 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2015_05.SyncConflictResolutionPolicy; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupState; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupSchema; + +class SyncGroupImpl extends CreatableUpdatableImpl implements SyncGroup, SyncGroup.Definition, SyncGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String syncGroupName; + + SyncGroupImpl(String name, SqlManager manager) { + super(name, new SyncGroupInner()); + this.manager = manager; + // Set resource name + this.syncGroupName = name; + // + } + + SyncGroupImpl(SyncGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.syncGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.syncGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncGroups"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SyncGroupsInner client = this.manager().inner().syncGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SyncGroupsInner client = this.manager().inner().syncGroups(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SyncGroupsInner client = this.manager().inner().syncGroups(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.inner().conflictResolutionPolicy(); + } + + @Override + public String hubDatabasePassword() { + return this.inner().hubDatabasePassword(); + } + + @Override + public String hubDatabaseUserName() { + return this.inner().hubDatabaseUserName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer interval() { + return this.inner().interval(); + } + + @Override + public DateTime lastSyncTime() { + return this.inner().lastSyncTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SyncGroupSchema schema() { + return this.inner().schema(); + } + + @Override + public String syncDatabaseId() { + return this.inner().syncDatabaseId(); + } + + @Override + public SyncGroupState syncState() { + return this.inner().syncState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SyncGroupImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public SyncGroupImpl withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.inner().withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + @Override + public SyncGroupImpl withHubDatabasePassword(String hubDatabasePassword) { + this.inner().withHubDatabasePassword(hubDatabasePassword); + return this; + } + + @Override + public SyncGroupImpl withHubDatabaseUserName(String hubDatabaseUserName) { + this.inner().withHubDatabaseUserName(hubDatabaseUserName); + return this; + } + + @Override + public SyncGroupImpl withInterval(Integer interval) { + this.inner().withInterval(interval); + return this; + } + + @Override + public SyncGroupImpl withSchema(SyncGroupSchema schema) { + this.inner().withSchema(schema); + return this; + } + + @Override + public SyncGroupImpl withSyncDatabaseId(String syncDatabaseId) { + this.inner().withSyncDatabaseId(syncDatabaseId); + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupInner.java new file mode 100644 index 0000000000000..f55584a12a718 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupInner.java @@ -0,0 +1,212 @@ +/** + * 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.v3_2015_05.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2015_05.SyncConflictResolutionPolicy; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupState; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupSchema; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync group. + */ +@JsonFlatten +public class SyncGroupInner extends ProxyResource { + /** + * Sync interval of the sync group. + */ + @JsonProperty(value = "properties.interval") + private Integer interval; + + /** + * Last sync time of the sync group. + */ + @JsonProperty(value = "properties.lastSyncTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastSyncTime; + + /** + * Conflict resolution policy of the sync group. Possible values include: + * 'HubWin', 'MemberWin'. + */ + @JsonProperty(value = "properties.conflictResolutionPolicy") + private SyncConflictResolutionPolicy conflictResolutionPolicy; + + /** + * ARM resource id of the sync database in the sync group. + */ + @JsonProperty(value = "properties.syncDatabaseId") + private String syncDatabaseId; + + /** + * User name for the sync group hub database credential. + */ + @JsonProperty(value = "properties.hubDatabaseUserName") + private String hubDatabaseUserName; + + /** + * Password for the sync group hub database credential. + */ + @JsonProperty(value = "properties.hubDatabasePassword") + private String hubDatabasePassword; + + /** + * Sync state of the sync group. Possible values include: 'NotReady', + * 'Error', 'Warning', 'Progressing', 'Good'. + */ + @JsonProperty(value = "properties.syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupState syncState; + + /** + * Sync schema of the sync group. + */ + @JsonProperty(value = "properties.schema") + private SyncGroupSchema schema; + + /** + * Get sync interval of the sync group. + * + * @return the interval value + */ + public Integer interval() { + return this.interval; + } + + /** + * Set sync interval of the sync group. + * + * @param interval the interval value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Get last sync time of the sync group. + * + * @return the lastSyncTime value + */ + public DateTime lastSyncTime() { + return this.lastSyncTime; + } + + /** + * Get conflict resolution policy of the sync group. Possible values include: 'HubWin', 'MemberWin'. + * + * @return the conflictResolutionPolicy value + */ + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set conflict resolution policy of the sync group. Possible values include: 'HubWin', 'MemberWin'. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get aRM resource id of the sync database in the sync group. + * + * @return the syncDatabaseId value + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set aRM resource id of the sync database in the sync group. + * + * @param syncDatabaseId the syncDatabaseId value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get user name for the sync group hub database credential. + * + * @return the hubDatabaseUserName value + */ + public String hubDatabaseUserName() { + return this.hubDatabaseUserName; + } + + /** + * Set user name for the sync group hub database credential. + * + * @param hubDatabaseUserName the hubDatabaseUserName value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withHubDatabaseUserName(String hubDatabaseUserName) { + this.hubDatabaseUserName = hubDatabaseUserName; + return this; + } + + /** + * Get password for the sync group hub database credential. + * + * @return the hubDatabasePassword value + */ + public String hubDatabasePassword() { + return this.hubDatabasePassword; + } + + /** + * Set password for the sync group hub database credential. + * + * @param hubDatabasePassword the hubDatabasePassword value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withHubDatabasePassword(String hubDatabasePassword) { + this.hubDatabasePassword = hubDatabasePassword; + return this; + } + + /** + * Get sync state of the sync group. Possible values include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good'. + * + * @return the syncState value + */ + public SyncGroupState syncState() { + return this.syncState; + } + + /** + * Get sync schema of the sync group. + * + * @return the schema value + */ + public SyncGroupSchema schema() { + return this.schema; + } + + /** + * Set sync schema of the sync group. + * + * @param schema the schema value to set + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSchema(SyncGroupSchema schema) { + this.schema = schema; + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesImpl.java new file mode 100644 index 0000000000000..355f0a8b171cd --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupLogProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupLogType; + +class SyncGroupLogPropertiesImpl extends WrapperImpl implements SyncGroupLogProperties { + private final SqlManager manager; + + SyncGroupLogPropertiesImpl(SyncGroupLogPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String details() { + return this.inner().details(); + } + + @Override + public String operationStatus() { + return this.inner().operationStatus(); + } + + @Override + public String source() { + return this.inner().source(); + } + + @Override + public DateTime timestamp() { + return this.inner().timestamp(); + } + + @Override + public UUID tracingId() { + return this.inner().tracingId(); + } + + @Override + public SyncGroupLogType type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesInner.java new file mode 100644 index 0000000000000..2f409fa744833 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupLogPropertiesInner.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.v3_2015_05.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupLogType; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an Azure SQL Database sync group log. + */ +public class SyncGroupLogPropertiesInner { + /** + * Timestamp of the sync group log. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * Type of the sync group log. Possible values include: 'All', 'Error', + * 'Warning', 'Success'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupLogType type; + + /** + * Source of the sync group log. + */ + @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) + private String source; + + /** + * Details of the sync group log. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private String details; + + /** + * TracingId of the sync group log. + */ + @JsonProperty(value = "tracingId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tracingId; + + /** + * OperationStatus of the sync group log. + */ + @JsonProperty(value = "operationStatus", access = JsonProperty.Access.WRITE_ONLY) + private String operationStatus; + + /** + * Get timestamp of the sync group log. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get type of the sync group log. Possible values include: 'All', 'Error', 'Warning', 'Success'. + * + * @return the type value + */ + public SyncGroupLogType type() { + return this.type; + } + + /** + * Get source of the sync group log. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Get details of the sync group log. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Get tracingId of the sync group log. + * + * @return the tracingId value + */ + public UUID tracingId() { + return this.tracingId; + } + + /** + * Get operationStatus of the sync group log. + * + * @return the operationStatus value + */ + public String operationStatus() { + return this.operationStatus; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsImpl.java new file mode 100644 index 0000000000000..6b7cb22c9e61e --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroup; +import com.microsoft.azure.management.sql.v3_2015_05.SyncDatabaseIdProperties; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.management.sql.v3_2015_05.SyncGroupLogProperties; + +class SyncGroupsImpl extends WrapperImpl implements SyncGroups { + private final SqlManager manager; + + SyncGroupsImpl(SqlManager manager) { + super(manager.inner().syncGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SyncGroupImpl define(String name) { + return wrapModel(name); + } + + private SyncGroupImpl wrapModel(SyncGroupInner inner) { + return new SyncGroupImpl(inner, manager()); + } + + private SyncGroupImpl wrapModel(String name) { + return new SyncGroupImpl(name, this.manager()); + } + + @Override + public Completable refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.refreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + @Override + public Completable cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.cancelSyncAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + @Override + public Completable triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.triggerSyncAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + SyncGroupsInner 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 SyncGroup call(SyncGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .map(new Func1() { + @Override + public SyncGroup call(SyncGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName).toCompletable(); + } + + private SyncDatabaseIdPropertiesImpl wrapSyncDatabaseIdPropertiesModel(SyncDatabaseIdPropertiesInner inner) { + return new SyncDatabaseIdPropertiesImpl(inner, manager()); + } + + private SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl wrapSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(SyncFullSchemaPropertiesInner inner) { + return new SyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(inner, manager()); + } + + private SyncGroupLogPropertiesImpl wrapSyncGroupLogPropertiesModel(SyncGroupLogPropertiesInner inner) { + return new SyncGroupLogPropertiesImpl(inner, manager()); + } + + @Override + public Observable listSyncDatabaseIdsAsync(final String locationName) { + SyncGroupsInner client = this.inner(); + return client.listSyncDatabaseIdsAsync(locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncDatabaseIdProperties call(SyncDatabaseIdPropertiesInner inner) { + return wrapSyncDatabaseIdPropertiesModel(inner); + } + }); + } + + @Override + public Observable listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + SyncGroupsInner client = this.inner(); + return client.listHubSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncGroupDatabasisServerSyncFullSchemaProperties call(SyncFullSchemaPropertiesInner inner) { + return wrapSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(inner); + } + }); + } + + @Override + public Observable listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + SyncGroupsInner client = this.inner(); + return client.listLogsAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncGroupLogProperties call(SyncGroupLogPropertiesInner inner) { + return wrapSyncGroupLogPropertiesModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsInner.java new file mode 100644 index 0000000000000..b76846a1203ff --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncGroupsInner.java @@ -0,0 +1,2362 @@ +/** + * 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.v3_2015_05.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.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 SyncGroups. + */ +public class SyncGroupsInner { + /** The Retrofit service to perform REST calls. */ + private SyncGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SyncGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SyncGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SyncGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface SyncGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.SyncGroups listSyncDatabaseIds" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds") + Observable> listSyncDatabaseIds(@Path("locationName") String locationName, @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.v3_2015_05.SyncGroups refreshHubSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema") + Observable> refreshHubSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups beginRefreshHubSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema") + Observable> beginRefreshHubSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups listHubSchemas" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas") + Observable> listHubSchemas(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups listLogs" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs") + Observable> listLogs(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Query("startTime") String startTime, @Query("endTime") String endTime, @Query("type") String type, @Query("continuationToken") String continuationToken, @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.v3_2015_05.SyncGroups cancelSync" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync") + Observable> cancelSync(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups triggerSync" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync") + Observable> triggerSync(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v3_2015_05.SyncGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v3_2015_05.SyncGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v3_2015_05.SyncGroups beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("subscriptionId") String subscriptionId, @Body SyncGroupInner 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.v3_2015_05.SyncGroups listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups") + 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.v3_2015_05.SyncGroups listSyncDatabaseIdsNext" }) + @GET + Observable> listSyncDatabaseIdsNext(@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.v3_2015_05.SyncGroups listHubSchemasNext" }) + @GET + Observable> listHubSchemasNext(@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.v3_2015_05.SyncGroups listLogsNext" }) + @GET + Observable> listLogsNext(@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.v3_2015_05.SyncGroups listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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<SyncDatabaseIdPropertiesInner> object if successful. + */ + public PagedList listSyncDatabaseIds(final String locationName) { + ServiceResponse> response = listSyncDatabaseIdsSinglePageAsync(locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @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> listSyncDatabaseIdsAsync(final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSyncDatabaseIdsSinglePageAsync(locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncDatabaseIdPropertiesInner> object + */ + public Observable> listSyncDatabaseIdsAsync(final String locationName) { + return listSyncDatabaseIdsWithServiceResponseAsync(locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncDatabaseIdPropertiesInner> object + */ + public Observable>> listSyncDatabaseIdsWithServiceResponseAsync(final String locationName) { + return listSyncDatabaseIdsSinglePageAsync(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(listSyncDatabaseIdsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + ServiceResponse> * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncDatabaseIdPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSyncDatabaseIdsSinglePageAsync(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."); + } + return service.listSyncDatabaseIds(locationName, 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 = listSyncDatabaseIdsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listSyncDatabaseIdsDelegate(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); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().last().body(); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> refreshHubSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 beginRefreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 beginRefreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRefreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a hub database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRefreshHubSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.beginRefreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, 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 = beginRefreshHubSchemaDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRefreshHubSchemaDelegate(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 collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listHubSchemas(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + ServiceResponse> response = listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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> listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable> listHubSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listHubSchemasWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listHubSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .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(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + 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 on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listHubSchemasSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.listHubSchemas(resourceGroupName, serverName, databaseName, syncGroupName, 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 = listHubSchemasDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listHubSchemasDelegate(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 collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @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<SyncGroupLogPropertiesInner> object if successful. + */ + public PagedList listLogs(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + ServiceResponse> response = listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @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> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + return listLogsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable>> listLogsWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + return listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type) + .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(listLogsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupLogPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLogsSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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 (startTime == null) { + throw new IllegalArgumentException("Parameter startTime is required and cannot be null."); + } + if (endTime == null) { + throw new IllegalArgumentException("Parameter endTime is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type 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 continuationToken = null; + return service.listLogs(resourceGroupName, serverName, databaseName, syncGroupName, this.client.subscriptionId(), startTime, endTime, type, continuationToken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLogsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this 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<SyncGroupLogPropertiesInner> object if successful. + */ + public PagedList listLogs(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + ServiceResponse> response = listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this operation. + * @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> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable> listLogsAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + return listLogsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param startTime Get logs generated after this time. + * @param endTime Get logs generated before this time. + * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupLogPropertiesInner> object + */ + public Observable>> listLogsWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + return listLogsSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type, continuationToken) + .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(listLogsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + 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 on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group. + ServiceResponse> * @param startTime Get logs generated after this time. + ServiceResponse> * @param endTime Get logs generated before this time. + ServiceResponse> * @param type The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' + ServiceResponse> * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupLogPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLogsSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String startTime, final String endTime, final String type, final String continuationToken) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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 (startTime == null) { + throw new IllegalArgumentException("Parameter startTime is required and cannot be null."); + } + if (endTime == null) { + throw new IllegalArgumentException("Parameter endTime is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type 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.listLogs(resourceGroupName, serverName, databaseName, syncGroupName, this.client.subscriptionId(), startTime, endTime, type, continuationToken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLogsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLogsDelegate(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); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelSyncWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.cancelSync(resourceGroupName, serverName, databaseName, syncGroupName, 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 = cancelSyncDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelSyncDelegate(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); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + triggerSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(triggerSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return triggerSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Triggers a sync group synchronization. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> triggerSyncWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.triggerSync(resourceGroupName, serverName, databaseName, syncGroupName, 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 = triggerSyncDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse triggerSyncDelegate(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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 SyncGroupInner object if successful. + */ + public SyncGroupInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().last().body(); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body(); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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 databaseName, String syncGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, databaseName, syncGroupName, 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 sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner update(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().last().body(); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, serverName, databaseName, syncGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 SyncGroupInner object if successful. + */ + public SyncGroupInner beginUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).toBlocking().single().body(); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group 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 serverName, String databaseName, String syncGroupName, SyncGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters), serviceCallback); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).map(new Func1, SyncGroupInner>() { + @Override + public SyncGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @param parameters The requested sync group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncGroupInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, SyncGroupInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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, serverName, databaseName, syncGroupName, 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); + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @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<SyncGroupInner> 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(); + } + }; + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @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); + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupInner> 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(); + } + }); + } + + /** + * Lists sync groups under a hub 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 on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncGroupInner> 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)); + } + }); + } + + /** + * Lists sync groups under a hub 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database on which the sync group is hosted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupInner> 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 collection of sync database ids. + * + * @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<SyncDatabaseIdPropertiesInner> object if successful. + */ + public PagedList listSyncDatabaseIdsNext(final String nextPageLink) { + ServiceResponse> response = listSyncDatabaseIdsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync database ids. + * + * @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> listSyncDatabaseIdsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSyncDatabaseIdsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync database ids. + * + * @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<SyncDatabaseIdPropertiesInner> object + */ + public Observable> listSyncDatabaseIdsNextAsync(final String nextPageLink) { + return listSyncDatabaseIdsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + * @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<SyncDatabaseIdPropertiesInner> object + */ + public Observable>> listSyncDatabaseIdsNextWithServiceResponseAsync(final String nextPageLink) { + return listSyncDatabaseIdsNextSinglePageAsync(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(listSyncDatabaseIdsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync database ids. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncDatabaseIdPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSyncDatabaseIdsNextSinglePageAsync(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.listSyncDatabaseIdsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSyncDatabaseIdsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listSyncDatabaseIdsNextDelegate(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 collection of hub database schemas. + * + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listHubSchemasNext(final String nextPageLink) { + ServiceResponse> response = listHubSchemasNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of hub database schemas. + * + * @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> listHubSchemasNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listHubSchemasNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listHubSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of hub database schemas. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable> listHubSchemasNextAsync(final String nextPageLink) { + return listHubSchemasNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listHubSchemasNextWithServiceResponseAsync(final String nextPageLink) { + return listHubSchemasNextSinglePageAsync(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(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of hub database schemas. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listHubSchemasNextSinglePageAsync(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.listHubSchemasNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listHubSchemasNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listHubSchemasNextDelegate(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 collection of sync group logs. + * + * @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<SyncGroupLogPropertiesInner> object if successful. + */ + public PagedList listLogsNext(final String nextPageLink) { + ServiceResponse> response = listLogsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a collection of sync group logs. + * + * @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> listLogsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listLogsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listLogsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a collection of sync group logs. + * + * @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<SyncGroupLogPropertiesInner> object + */ + public Observable> listLogsNextAsync(final String nextPageLink) { + return listLogsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + * @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<SyncGroupLogPropertiesInner> object + */ + public Observable>> listLogsNextWithServiceResponseAsync(final String nextPageLink) { + return listLogsNextSinglePageAsync(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(listLogsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a collection of sync group logs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncGroupLogPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listLogsNextSinglePageAsync(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.listLogsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLogsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLogsNextDelegate(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 sync groups under a hub 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<SyncGroupInner> 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 sync groups under a hub 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 sync groups under a hub 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<SyncGroupInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync groups under a hub 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<SyncGroupInner> 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 sync groups under a hub 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<SyncGroupInner> 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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberImpl.java new file mode 100644 index 0000000000000..b57ec5f94a93b --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberImpl.java @@ -0,0 +1,197 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncMember; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberDbType; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2015_05.SyncDirection; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberState; + +class SyncMemberImpl extends CreatableUpdatableImpl implements SyncMember, SyncMember.Definition, SyncMember.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String syncGroupName; + private String syncMemberName; + + SyncMemberImpl(String name, SqlManager manager) { + super(name, new SyncMemberInner()); + this.manager = manager; + // Set resource name + this.syncMemberName = name; + // + } + + SyncMemberImpl(SyncMemberInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.syncMemberName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.syncGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncGroups"); + this.syncMemberName = IdParsingUtils.getValueFromIdByName(inner.id(), "syncMembers"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SyncMembersInner client = this.manager().inner().syncMembers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.syncMemberName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SyncMembersInner client = this.manager().inner().syncMembers(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.syncMemberName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SyncMembersInner client = this.manager().inner().syncMembers(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.syncGroupName, this.syncMemberName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public SyncMemberDbType databaseType() { + return this.inner().databaseType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String password() { + return this.inner().password(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public UUID sqlServerDatabaseId() { + return this.inner().sqlServerDatabaseId(); + } + + @Override + public String syncAgentId() { + return this.inner().syncAgentId(); + } + + @Override + public SyncDirection syncDirection() { + return this.inner().syncDirection(); + } + + @Override + public SyncMemberState syncState() { + return this.inner().syncState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userName() { + return this.inner().userName(); + } + + @Override + public SyncMemberImpl withExistingSyncGroup(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.syncGroupName = syncGroupName; + return this; + } + + @Override + public SyncMemberImpl withDatabaseName(String databaseName) { + this.inner().withDatabaseName(databaseName); + return this; + } + + @Override + public SyncMemberImpl withDatabaseType(SyncMemberDbType databaseType) { + this.inner().withDatabaseType(databaseType); + return this; + } + + @Override + public SyncMemberImpl withPassword(String password) { + this.inner().withPassword(password); + return this; + } + + @Override + public SyncMemberImpl withServerName(String serverName) { + this.inner().withServerName(serverName); + return this; + } + + @Override + public SyncMemberImpl withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.inner().withSqlServerDatabaseId(sqlServerDatabaseId); + return this; + } + + @Override + public SyncMemberImpl withSyncAgentId(String syncAgentId) { + this.inner().withSyncAgentId(syncAgentId); + return this; + } + + @Override + public SyncMemberImpl withSyncDirection(SyncDirection syncDirection) { + this.inner().withSyncDirection(syncDirection); + return this; + } + + @Override + public SyncMemberImpl withUserName(String userName) { + this.inner().withUserName(userName); + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberInner.java new file mode 100644 index 0000000000000..5487b1aad1f14 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberInner.java @@ -0,0 +1,255 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberDbType; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2015_05.SyncDirection; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An Azure SQL Database sync member. + */ +@JsonFlatten +public class SyncMemberInner extends ProxyResource { + /** + * Database type of the sync member. Possible values include: + * 'AzureSqlDatabase', 'SqlServerDatabase'. + */ + @JsonProperty(value = "properties.databaseType") + private SyncMemberDbType databaseType; + + /** + * ARM resource id of the sync agent in the sync member. + */ + @JsonProperty(value = "properties.syncAgentId") + private String syncAgentId; + + /** + * SQL Server database id of the sync member. + */ + @JsonProperty(value = "properties.sqlServerDatabaseId") + private UUID sqlServerDatabaseId; + + /** + * Server name of the member database in the sync member. + */ + @JsonProperty(value = "properties.serverName") + private String serverName; + + /** + * Database name of the member database in the sync member. + */ + @JsonProperty(value = "properties.databaseName") + private String databaseName; + + /** + * User name of the member database in the sync member. + */ + @JsonProperty(value = "properties.userName") + private String userName; + + /** + * Password of the member database in the sync member. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * Sync direction of the sync member. Possible values include: + * 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember'. + */ + @JsonProperty(value = "properties.syncDirection") + private SyncDirection syncDirection; + + /** + * Sync state of the sync member. Possible values include: + * 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', + * 'DisabledTombstoneCleanup', 'DisabledBackupRestore', + * 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', + * 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', + * 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', + * 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'. + */ + @JsonProperty(value = "properties.syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberState syncState; + + /** + * Get database type of the sync member. Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase'. + * + * @return the databaseType value + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Set database type of the sync member. Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase'. + * + * @param databaseType the databaseType value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withDatabaseType(SyncMemberDbType databaseType) { + this.databaseType = databaseType; + return this; + } + + /** + * Get aRM resource id of the sync agent in the sync member. + * + * @return the syncAgentId value + */ + public String syncAgentId() { + return this.syncAgentId; + } + + /** + * Set aRM resource id of the sync agent in the sync member. + * + * @param syncAgentId the syncAgentId value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncAgentId(String syncAgentId) { + this.syncAgentId = syncAgentId; + return this; + } + + /** + * Get sQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value + */ + public UUID sqlServerDatabaseId() { + return this.sqlServerDatabaseId; + } + + /** + * Set sQL Server database id of the sync member. + * + * @param sqlServerDatabaseId the sqlServerDatabaseId value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.sqlServerDatabaseId = sqlServerDatabaseId; + return this; + } + + /** + * Get server name of the member database in the sync member. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set server name of the member database in the sync member. + * + * @param serverName the serverName value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get database name of the member database in the sync member. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set database name of the member database in the sync member. + * + * @param databaseName the databaseName value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get user name of the member database in the sync member. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set user name of the member database in the sync member. + * + * @param userName the userName value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get password of the member database in the sync member. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set password of the member database in the sync member. + * + * @param password the password value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get sync direction of the sync member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember'. + * + * @return the syncDirection value + */ + public SyncDirection syncDirection() { + return this.syncDirection; + } + + /** + * Set sync direction of the sync member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember'. + * + * @param syncDirection the syncDirection value to set + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncDirection(SyncDirection syncDirection) { + this.syncDirection = syncDirection; + return this; + } + + /** + * Get sync state of the sync member. Possible values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', 'DisabledTombstoneCleanup', 'DisabledBackupRestore', 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'. + * + * @return the syncState value + */ + public SyncMemberState syncState() { + return this.syncState; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.java new file mode 100644 index 0000000000000..fe48ca6fcedfd --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2015_05.SyncFullSchemaTable; + +class SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl extends WrapperImpl implements SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties { + private final SqlManager manager; + + SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(SyncFullSchemaPropertiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime lastUpdateTime() { + return this.inner().lastUpdateTime(); + } + + @Override + public List tables() { + return this.inner().tables(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersImpl.java new file mode 100644 index 0000000000000..78afa1d849c41 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersImpl.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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMembers; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMember; +import com.microsoft.azure.management.sql.v3_2015_05.SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties; + +class SyncMembersImpl extends WrapperImpl implements SyncMembers { + private final SqlManager manager; + + SyncMembersImpl(SqlManager manager) { + super(manager.inner().syncMembers()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SyncMemberImpl define(String name) { + return wrapModel(name); + } + + private SyncMemberImpl wrapModel(SyncMemberInner inner) { + return new SyncMemberImpl(inner, manager()); + } + + private SyncMemberImpl wrapModel(String name) { + return new SyncMemberImpl(name, this.manager()); + } + + @Override + public Completable refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.refreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toCompletable(); + } + + @Override + public Observable listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + SyncMembersInner client = this.inner(); + return client.listBySyncGroupAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncMember call(SyncMemberInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .map(new Func1() { + @Override + public SyncMember call(SyncMemberInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toCompletable(); + } + + private SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl wrapSyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(SyncFullSchemaPropertiesInner inner) { + return new SyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesImpl(inner, manager()); + } + + @Override + public Observable listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + SyncMembersInner client = this.inner(); + return client.listMemberSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SyncMemberSyncGroupDatabasisServerSyncFullSchemaProperties call(SyncFullSchemaPropertiesInner inner) { + return wrapSyncMemberSyncGroupDatabasisServerSyncFullSchemaPropertiesModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersInner.java new file mode 100644 index 0000000000000..331a964ac5169 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/SyncMembersInner.java @@ -0,0 +1,1557 @@ +/** + * 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.v3_2015_05.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.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 SyncMembers. + */ +public class SyncMembersInner { + /** The Retrofit service to perform REST calls. */ + private SyncMembersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncMembersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SyncMembersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SyncMembersService.class); + this.client = client; + } + + /** + * The interface defining all the services for SyncMembers to be + * used by Retrofit to perform actually REST calls. + */ + interface SyncMembersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.SyncMembers get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v3_2015_05.SyncMembers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v3_2015_05.SyncMembers beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v3_2015_05.SyncMembers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v3_2015_05.SyncMembers beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v3_2015_05.SyncMembers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v3_2015_05.SyncMembers beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @Path("subscriptionId") String subscriptionId, @Body SyncMemberInner 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.v3_2015_05.SyncMembers listBySyncGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers") + Observable> listBySyncGroup(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @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.v3_2015_05.SyncMembers listMemberSchemas" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/schemas") + Observable> listMemberSchemas(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v3_2015_05.SyncMembers refreshMemberSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema") + Observable> refreshMemberSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v3_2015_05.SyncMembers beginRefreshMemberSchema" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema") + Observable> beginRefreshMemberSchema(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("syncGroupName") String syncGroupName, @Path("syncMemberName") String syncMemberName, @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.v3_2015_05.SyncMembers listBySyncGroupNext" }) + @GET + Observable> listBySyncGroupNext(@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.v3_2015_05.SyncMembers listMemberSchemasNext" }) + @GET + Observable> listMemberSchemasNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 SyncMemberInner object if successful. + */ + public SyncMemberInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single().body(); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().last().body(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single().body(); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, databaseName, syncGroupName, syncMemberName, 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 sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner update(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, serverName, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 SyncMemberInner object if successful. + */ + public SyncMemberInner beginUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member 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 serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters), serviceCallback); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1, SyncMemberInner>() { + @Override + public SyncMemberInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing sync member. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @param parameters The requested sync member resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SyncMemberInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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, serverName, databaseName, syncGroupName, syncMemberName, 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); + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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<SyncMemberInner> object if successful. + */ + public PagedList listBySyncGroup(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + ServiceResponse> response = listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @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> listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncMemberInner> object + */ + public Observable> listBySyncGroupAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listBySyncGroupWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync members in the given sync 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 serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncMemberInner> object + */ + public Observable>> listBySyncGroupWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + return listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .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(listBySyncGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists sync members in the given sync 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. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncMemberInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySyncGroupSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName 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.listBySyncGroup(resourceGroupName, serverName, databaseName, syncGroupName, 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 = listBySyncGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySyncGroupDelegate(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 sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listMemberSchemas(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + ServiceResponse> response = listMemberSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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> listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listMemberSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable> listMemberSchemasAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + return listMemberSchemasWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listMemberSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + return listMemberSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .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(listMemberSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a sync member database schema. + * + 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 on which the sync group is hosted. + ServiceResponse> * @param syncGroupName The name of the sync group on which the sync member is hosted. + ServiceResponse> * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listMemberSchemasSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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.listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, 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 = listMemberSchemasDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMemberSchemasDelegate(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); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 refreshMemberSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().last().body(); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> refreshMemberSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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.refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 beginRefreshMemberSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single().body(); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @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 beginRefreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), serviceCallback); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRefreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refreshes a sync member database schema. + * + * @param resourceGroupName The 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 on which the sync group is hosted. + * @param syncGroupName The name of the sync group on which the sync member is hosted. + * @param syncMemberName The name of the sync member. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRefreshMemberSchemaWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + 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 (syncGroupName == null) { + throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null."); + } + if (syncMemberName == null) { + throw new IllegalArgumentException("Parameter syncMemberName 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.beginRefreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, 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 = beginRefreshMemberSchemaDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRefreshMemberSchemaDelegate(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 sync members in the given sync 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<SyncMemberInner> object if successful. + */ + public PagedList listBySyncGroupNext(final String nextPageLink) { + ServiceResponse> response = listBySyncGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists sync members in the given sync 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> listBySyncGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySyncGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists sync members in the given sync 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<SyncMemberInner> object + */ + public Observable> listBySyncGroupNextAsync(final String nextPageLink) { + return listBySyncGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists sync members in the given sync 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<SyncMemberInner> object + */ + public Observable>> listBySyncGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listBySyncGroupNextSinglePageAsync(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(listBySyncGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists sync members in the given sync 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<SyncMemberInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySyncGroupNextSinglePageAsync(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.listBySyncGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySyncGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySyncGroupNextDelegate(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 sync member database schema. + * + * @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<SyncFullSchemaPropertiesInner> object if successful. + */ + public PagedList listMemberSchemasNext(final String nextPageLink) { + ServiceResponse> response = listMemberSchemasNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a sync member database schema. + * + * @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> listMemberSchemasNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listMemberSchemasNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a sync member database schema. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable> listMemberSchemasNextAsync(final String nextPageLink) { + return listMemberSchemasNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a sync member database schema. + * + * @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<SyncFullSchemaPropertiesInner> object + */ + public Observable>> listMemberSchemasNextWithServiceResponseAsync(final String nextPageLink) { + return listMemberSchemasNextSinglePageAsync(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(listMemberSchemasNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a sync member database schema. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SyncFullSchemaPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listMemberSchemasNextSinglePageAsync(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.listMemberSchemasNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMemberSchemasNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMemberSchemasNextDelegate(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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 0000000000000..10bb22bb9e646 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleImpl.java @@ -0,0 +1,122 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.VirtualNetworkRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2015_05.VirtualNetworkRuleState; + +class VirtualNetworkRuleImpl extends CreatableUpdatableImpl implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String virtualNetworkRuleName; + + VirtualNetworkRuleImpl(String name, SqlManager manager) { + super(name, new VirtualNetworkRuleInner()); + this.manager = manager; + // Set resource name + this.virtualNetworkRuleName = name; + // + } + + VirtualNetworkRuleImpl(VirtualNetworkRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.virtualNetworkRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.virtualNetworkRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualNetworkRules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualNetworkRulesInner client = this.manager().inner().virtualNetworkRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.virtualNetworkRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualNetworkRulesInner client = this.manager().inner().virtualNetworkRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.virtualNetworkRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualNetworkRulesInner client = this.manager().inner().virtualNetworkRules(); + return client.getAsync(this.resourceGroupName, this.serverName, this.virtualNetworkRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.inner().ignoreMissingVnetServiceEndpoint(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public VirtualNetworkRuleState state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String virtualNetworkSubnetId() { + return this.inner().virtualNetworkSubnetId(); + } + + @Override + public VirtualNetworkRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public VirtualNetworkRuleImpl withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.inner().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + @Override + public VirtualNetworkRuleImpl withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.inner().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleInner.java new file mode 100644 index 0000000000000..0d8f58c9cdf07 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRuleInner.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.management.sql.v3_2015_05.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A virtual network rule. + */ +@JsonFlatten +public class VirtualNetworkRuleInner extends ProxyResource { + /** + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "properties.virtualNetworkSubnetId", required = true) + private String virtualNetworkSubnetId; + + /** + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "properties.ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Virtual Network Rule State. Possible values include: 'Initializing', + * 'InProgress', 'Ready', 'Deleting', 'Unknown'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** + * Get the ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get virtual Network Rule State. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown'. + * + * @return the state value + */ + public VirtualNetworkRuleState state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesImpl.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 0000000000000..0fccd2708d7a9 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2015_05.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2015_05.VirtualNetworkRules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2015_05.VirtualNetworkRule; + +class VirtualNetworkRulesImpl extends WrapperImpl implements VirtualNetworkRules { + private final SqlManager manager; + + VirtualNetworkRulesImpl(SqlManager manager) { + super(manager.inner().virtualNetworkRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public VirtualNetworkRuleImpl define(String name) { + return wrapModel(name); + } + + private VirtualNetworkRuleImpl wrapModel(VirtualNetworkRuleInner inner) { + return new VirtualNetworkRuleImpl(inner, manager()); + } + + private VirtualNetworkRuleImpl wrapModel(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + VirtualNetworkRulesInner 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 VirtualNetworkRule call(VirtualNetworkRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRulesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .map(new Func1() { + @Override + public VirtualNetworkRule call(VirtualNetworkRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesInner.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesInner.java new file mode 100644 index 0000000000000..fb8206768414f --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/VirtualNetworkRulesInner.java @@ -0,0 +1,777 @@ +/** + * 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.v3_2015_05.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 VirtualNetworkRules. + */ +public class VirtualNetworkRulesInner { + /** The Retrofit service to perform REST calls. */ + private VirtualNetworkRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualNetworkRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(VirtualNetworkRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualNetworkRules to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualNetworkRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2015_05.VirtualNetworkRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.v3_2015_05.VirtualNetworkRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Path("subscriptionId") String subscriptionId, @Body VirtualNetworkRuleInner 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.v3_2015_05.VirtualNetworkRules beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Path("subscriptionId") String subscriptionId, @Body VirtualNetworkRuleInner 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.v3_2015_05.VirtualNetworkRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.v3_2015_05.VirtualNetworkRules beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.v3_2015_05.VirtualNetworkRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules") + 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.v3_2015_05.VirtualNetworkRules listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner beginCreateOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().last().body(); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the virtual network rule with the 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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 a list of virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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 virtual network rules in 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<VirtualNetworkRuleInner> 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/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/package-info.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/package-info.java new file mode 100644 index 0000000000000..4c44c2611fdc2 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2015_05.implementation; diff --git a/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/package-info.java b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/package-info.java new file mode 100644 index 0000000000000..3c06033bae2d6 --- /dev/null +++ b/sql/resource-manager/v3_2015_05/src/main/java/com/microsoft/azure/management/sql/v3_2015_05/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2015_05; diff --git a/sql/resource-manager/v3_2017_03/pom.xml b/sql/resource-manager/v3_2017_03/pom.xml new file mode 100644 index 0000000000000..24fa1d09bcab1 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v3_2017_03 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeActual.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeActual.java new file mode 100644 index 0000000000000..5f945118f987b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeActual.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeActual. + */ +public enum AutomaticTuningOptionModeActual { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"); + + /** The actual serialized value for a AutomaticTuningOptionModeActual instance. */ + private String value; + + AutomaticTuningOptionModeActual(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeActual instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeActual object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeActual fromString(String value) { + AutomaticTuningOptionModeActual[] items = AutomaticTuningOptionModeActual.values(); + for (AutomaticTuningOptionModeActual item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeDesired.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeDesired.java new file mode 100644 index 0000000000000..3502ed1e9c7bd --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningOptionModeDesired.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningOptionModeDesired. + */ +public enum AutomaticTuningOptionModeDesired { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutomaticTuningOptionModeDesired instance. */ + private String value; + + AutomaticTuningOptionModeDesired(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningOptionModeDesired instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningOptionModeDesired object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningOptionModeDesired fromString(String value) { + AutomaticTuningOptionModeDesired[] items = AutomaticTuningOptionModeDesired.values(); + for (AutomaticTuningOptionModeDesired item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerMode.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerMode.java new file mode 100644 index 0000000000000..696d2ed94ca57 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerMode.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningServerMode. + */ +public enum AutomaticTuningServerMode { + /** Enum value Custom. */ + CUSTOM("Custom"), + + /** Enum value Auto. */ + AUTO("Auto"), + + /** Enum value Unspecified. */ + UNSPECIFIED("Unspecified"); + + /** The actual serialized value for a AutomaticTuningServerMode instance. */ + private String value; + + AutomaticTuningServerMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningServerMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningServerMode object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningServerMode fromString(String value) { + AutomaticTuningServerMode[] items = AutomaticTuningServerMode.values(); + for (AutomaticTuningServerMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerOptions.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerOptions.java new file mode 100644 index 0000000000000..eb63c3e2c0e09 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerOptions.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Automatic tuning properties for individual advisors. + */ +public class AutomaticTuningServerOptions { + /** + * Automatic tuning option desired state. Possible values include: 'Off', + * 'On', 'Default'. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /** + * Automatic tuning option actual state. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningOptionModeActual actualState; + + /** + * Reason code if desired and actual state are different. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer reasonCode; + + /** + * Reason description if desired and actual state are different. Possible + * values include: 'Default', 'Disabled', 'AutoConfigured'. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerReason reasonDesc; + + /** + * Get automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @return the desiredState value + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning option desired state. Possible values include: 'Off', 'On', 'Default'. + * + * @param desiredState the desiredState value to set + * @return the AutomaticTuningServerOptions object itself. + */ + public AutomaticTuningServerOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning option actual state. Possible values include: 'Off', 'On'. + * + * @return the actualState value + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get reason code if desired and actual state are different. + * + * @return the reasonCode value + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get reason description if desired and actual state are different. Possible values include: 'Default', 'Disabled', 'AutoConfigured'. + * + * @return the reasonDesc value + */ + public AutomaticTuningServerReason reasonDesc() { + return this.reasonDesc; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerReason.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerReason.java new file mode 100644 index 0000000000000..c64b6e0e8c8ca --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/AutomaticTuningServerReason.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutomaticTuningServerReason. + */ +public enum AutomaticTuningServerReason { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value AutoConfigured. */ + AUTO_CONFIGURED("AutoConfigured"); + + /** The actual serialized value for a AutomaticTuningServerReason instance. */ + private String value; + + AutomaticTuningServerReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomaticTuningServerReason instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomaticTuningServerReason object, or null if unable to parse. + */ + @JsonCreator + public static AutomaticTuningServerReason fromString(String value) { + AutomaticTuningServerReason[] items = AutomaticTuningServerReason.values(); + for (AutomaticTuningServerReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicies.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicies.java new file mode 100644 index 0000000000000..f2292c64fcf6d --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicies.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.BackupLongTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BackupLongTermRetentionPolicies. + */ +public interface BackupLongTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicy.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicy.java new file mode 100644 index 0000000000000..2fe8abe0f454a --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BackupLongTermRetentionPolicy.java @@ -0,0 +1,185 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.BackupLongTermRetentionPolicyInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing BackupLongTermRetentionPolicy. + */ +public interface BackupLongTermRetentionPolicy 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 BackupLongTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackupLongTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackupLongTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify MonthlyRetention. + */ + interface WithMonthlyRetention { + /** + * Specifies monthlyRetention. + */ + WithCreate withMonthlyRetention(String monthlyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify WeeklyRetention. + */ + interface WithWeeklyRetention { + /** + * Specifies weeklyRetention. + */ + WithCreate withWeeklyRetention(String weeklyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify WeekOfYear. + */ + interface WithWeekOfYear { + /** + * Specifies weekOfYear. + */ + WithCreate withWeekOfYear(Integer weekOfYear); + } + + /** + * The stage of the backuplongtermretentionpolicy definition allowing to specify YearlyRetention. + */ + interface WithYearlyRetention { + /** + * Specifies yearlyRetention. + */ + 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 BackupLongTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithMonthlyRetention, UpdateStages.WithWeeklyRetention, UpdateStages.WithWeekOfYear, UpdateStages.WithYearlyRetention { + } + + /** + * Grouping of BackupLongTermRetentionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify MonthlyRetention. + */ + interface WithMonthlyRetention { + /** + * Specifies monthlyRetention. + */ + Update withMonthlyRetention(String monthlyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify WeeklyRetention. + */ + interface WithWeeklyRetention { + /** + * Specifies weeklyRetention. + */ + Update withWeeklyRetention(String weeklyRetention); + } + + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify WeekOfYear. + */ + interface WithWeekOfYear { + /** + * Specifies weekOfYear. + */ + Update withWeekOfYear(Integer weekOfYear); + } + + /** + * The stage of the backuplongtermretentionpolicy update allowing to specify YearlyRetention. + */ + interface WithYearlyRetention { + /** + * Specifies yearlyRetention. + */ + Update withYearlyRetention(String yearlyRetention); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BlobAuditingPolicyState.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BlobAuditingPolicyState.java new file mode 100644 index 0000000000000..794854a6abdae --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/BlobAuditingPolicyState.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for BlobAuditingPolicyState. + */ +public enum BlobAuditingPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a BlobAuditingPolicyState instance. */ + private String value; + + BlobAuditingPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BlobAuditingPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed BlobAuditingPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static BlobAuditingPolicyState fromString(String value) { + BlobAuditingPolicyState[] items = BlobAuditingPolicyState.values(); + for (BlobAuditingPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CatalogCollationType.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CatalogCollationType.java new file mode 100644 index 0000000000000..40880b721529b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/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.v3_2017_03; + +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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CompleteDatabaseRestoreDefinition.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CompleteDatabaseRestoreDefinition.java new file mode 100644 index 0000000000000..b24d3b1a2b51b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/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.v3_2017_03; + +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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CreateDatabaseRestorePointDefinition.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CreateDatabaseRestorePointDefinition.java new file mode 100644 index 0000000000000..346f97f11ebe0 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/CreateDatabaseRestorePointDefinition.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a create database restore + * point operation. + */ +public class CreateDatabaseRestorePointDefinition { + /** + * The restore point label to apply. + */ + @JsonProperty(value = "restorePointLabel", required = true) + private String restorePointLabel; + + /** + * Get the restore point label to apply. + * + * @return the restorePointLabel value + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + + /** + * Set the restore point label to apply. + * + * @param restorePointLabel the restorePointLabel value to set + * @return the CreateDatabaseRestorePointDefinition object itself. + */ + public CreateDatabaseRestorePointDefinition withRestorePointLabel(String restorePointLabel) { + this.restorePointLabel = restorePointLabel; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicies.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..996200fcc1eff --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.DatabaseBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseBlobAuditingPolicies. + */ +public interface DatabaseBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicy.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..d87359b93206c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseBlobAuditingPolicy.java @@ -0,0 +1,282 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.DatabaseBlobAuditingPolicyInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing DatabaseBlobAuditingPolicy. + */ +public interface DatabaseBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseBlobAuditingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databaseblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a DatabaseBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of DatabaseBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databaseblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the databaseblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessment.java new file mode 100644 index 0000000000000..1b146b2356de3 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessment.java @@ -0,0 +1,185 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.DatabaseVulnerabilityAssessmentInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing DatabaseVulnerabilityAssessment. + */ +public interface DatabaseVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessment definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a DatabaseVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerPath, UpdateStages.WithStorageContainerSasKey { + } + + /** + * Grouping of DatabaseVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + Update withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaseline.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..b2c849169045f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaseline.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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.DatabaseVulnerabilityAssessmentRuleBaselineInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.List; + +/** + * Type representing DatabaseVulnerabilityAssessmentRuleBaseline. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaseline extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the baselineResults value. + */ + List baselineResults(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRule, DefinitionStages.WithBaselineResults, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Blank extends WithRule { + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify Rule. + */ + interface WithRule { + /** + * Specifies resourceGroupName, serverName, databaseName, ruleId. + */ + WithBaselineResults withExistingRule(String resourceGroupName, String serverName, String databaseName, String ruleId); + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + WithCreate withBaselineResults(List baselineResults); + } + + /** + * 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 { + } + } + /** + * The template for a DatabaseVulnerabilityAssessmentRuleBaseline update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBaselineResults { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessmentrulebaseline update allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + Update withBaselineResults(List baselineResults); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 0000000000000..b76a2db6d3a33 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselineItem.java @@ -0,0 +1,45 @@ +/** + * 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.v3_2017_03; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for an Azure SQL Database Vulnerability Assessment rule + * baseline's result. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /** + * The rule baseline result. + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** + * Get the rule baseline result. + * + * @return the result value + */ + public List result() { + return this.result; + } + + /** + * Set the rule baseline result. + * + * @param result the result value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineItem object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem withResult(List result) { + this.result = result; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselines.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..1afc1c2dad6a2 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,51 @@ +/** + * 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.v3_2017_03; + +import rx.Observable; +import rx.Completable; + +/** + * Type representing DatabaseVulnerabilityAssessmentRuleBaselines. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaselines { + /** + * Begins definition for a new Baseline resource. + * @param name resource name. + * @return the first stage of the new Baseline definition. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank defineBaseline(String name); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessments.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..a56a4d7ae6a7e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/DatabaseVulnerabilityAssessments.java @@ -0,0 +1,54 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.DatabaseVulnerabilityAssessmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseVulnerabilityAssessments. + */ +public interface DatabaseVulnerabilityAssessments extends SupportsCreating, HasInner { + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are 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); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecution.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecution.java new file mode 100644 index 0000000000000..641df2a68a8ef --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecution.java @@ -0,0 +1,104 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobExecutionInner; +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.v3_2017_03.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ExecutionJobJobAgentServerJobExecution. + */ +public interface ExecutionJobJobAgentServerJobExecution extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the createTime value. + */ + DateTime createTime(); + + /** + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * @return the currentAttemptStartTime value. + */ + DateTime currentAttemptStartTime(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the stepName value. + */ + String stepName(); + + /** + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecutionModel.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecutionModel.java new file mode 100644 index 0000000000000..333fb9303a82f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExecutionJobJobAgentServerJobExecutionModel.java @@ -0,0 +1,102 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobExecutionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ExecutionJobJobAgentServerJobExecutionModel. + */ +public interface ExecutionJobJobAgentServerJobExecutionModel extends HasInner, HasManager { + /** + * @return the createTime value. + */ + DateTime createTime(); + + /** + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * @return the currentAttemptStartTime value. + */ + DateTime currentAttemptStartTime(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the stepName value. + */ + String stepName(); + + /** + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicies.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..a1742d717eb4f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ExtendedDatabaseBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ExtendedDatabaseBlobAuditingPolicies. + */ +public interface ExtendedDatabaseBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets an extended database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicy.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..4bbc8522662f4 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedDatabaseBlobAuditingPolicy.java @@ -0,0 +1,302 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ExtendedDatabaseBlobAuditingPolicyInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ExtendedDatabaseBlobAuditingPolicy. + */ +public interface ExtendedDatabaseBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ExtendedDatabaseBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ExtendedDatabaseBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ExtendedDatabaseBlobAuditingPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithPredicateExpression, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ExtendedDatabaseBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithPredicateExpression, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ExtendedDatabaseBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + Update withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendeddatabaseblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicies.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..6160450725781 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicies.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ExtendedServerBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ExtendedServerBlobAuditingPolicies. + */ +public interface ExtendedServerBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets an extended server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicy.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..cba513b3c9175 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ExtendedServerBlobAuditingPolicy.java @@ -0,0 +1,302 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ExtendedServerBlobAuditingPolicyInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ExtendedServerBlobAuditingPolicy. + */ +public interface ExtendedServerBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ExtendedServerBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ExtendedServerBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ExtendedServerBlobAuditingPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithState withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendedserverblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithPredicateExpression, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ExtendedServerBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithPredicateExpression, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ExtendedServerBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify PredicateExpression. + */ + interface WithPredicateExpression { + /** + * Specifies predicateExpression. + */ + Update withPredicateExpression(String predicateExpression); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the extendedserverblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Job.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Job.java new file mode 100644 index 0000000000000..de232e2ce1e01 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Job.java @@ -0,0 +1,140 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing Job. + */ +public interface Job extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the schedule value. + */ + JobSchedule schedule(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the version value. + */ + Integer version(); + + /** + * The entirety of the Job definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithCreate { + } + + /** + * Grouping of Job definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Job definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the job definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + + /** + * The stage of the job definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the job definition allowing to specify Schedule. + */ + interface WithSchedule { + /** + * Specifies schedule. + */ + WithCreate withSchedule(JobSchedule schedule); + } + + /** + * 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.WithDescription, DefinitionStages.WithSchedule { + } + } + /** + * The template for a Job update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithSchedule { + } + + /** + * Grouping of Job update stages. + */ + interface UpdateStages { + /** + * The stage of the job update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + */ + Update withDescription(String description); + } + + /** + * The stage of the job update allowing to specify Schedule. + */ + interface WithSchedule { + /** + * Specifies schedule. + */ + Update withSchedule(JobSchedule schedule); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgent.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgent.java new file mode 100644 index 0000000000000..2a652895b401b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgent.java @@ -0,0 +1,171 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobAgentInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.Map; + +/** + * Type representing JobAgent. + */ +public interface JobAgent extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the databaseId value. + */ + String databaseId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the state value. + */ + JobAgentState state(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobAgent definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithDatabaseId, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobAgent definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobAgent definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the jobagent definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithDatabaseId withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the jobagent definition allowing to specify DatabaseId. + */ + interface WithDatabaseId { + /** + * Specifies databaseId. + */ + WithLocation withDatabaseId(String databaseId); + } + + /** + * The stage of the jobagent definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the jobagent definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the jobagent definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + 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.WithSku, DefinitionStages.WithTags { + } + } + /** + * The template for a JobAgent update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithSku, UpdateStages.WithTags { + } + + /** + * Grouping of JobAgent update stages. + */ + interface UpdateStages { + /** + * The stage of the jobagent update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the jobagent update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentServerJobExecution.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentServerJobExecution.java new file mode 100644 index 0000000000000..a9f8a40f4381a --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentServerJobExecution.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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobExecutionInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; + +/** + * Type representing JobAgentServerJobExecution. + */ +public interface JobAgentServerJobExecution extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the createTime value. + */ + DateTime createTime(); + + /** + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * @return the currentAttemptStartTime value. + */ + DateTime currentAttemptStartTime(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the stepName value. + */ + String stepName(); + + /** + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobAgentServerJobExecution definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobAgentServerJobExecution definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobAgentServerJobExecution definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the jobagentserverjobexecution definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName, jobName. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName, String jobName); + } + + /** + * 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 { + } + } + /** + * The template for a JobAgentServerJobExecution update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of JobAgentServerJobExecution update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentState.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentState.java new file mode 100644 index 0000000000000..7d3e4c4974838 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentState.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobAgentState. + */ +public final class JobAgentState extends ExpandableStringEnum { + /** Static value Creating for JobAgentState. */ + public static final JobAgentState CREATING = fromString("Creating"); + + /** Static value Ready for JobAgentState. */ + public static final JobAgentState READY = fromString("Ready"); + + /** Static value Updating for JobAgentState. */ + public static final JobAgentState UPDATING = fromString("Updating"); + + /** Static value Deleting for JobAgentState. */ + public static final JobAgentState DELETING = fromString("Deleting"); + + /** Static value Disabled for JobAgentState. */ + public static final JobAgentState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a JobAgentState from its string representation. + * @param name a name to look for + * @return the corresponding JobAgentState + */ + @JsonCreator + public static JobAgentState fromString(String name) { + return fromString(name, JobAgentState.class); + } + + /** + * @return known JobAgentState values + */ + public static Collection values() { + return values(JobAgentState.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentUpdate.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentUpdate.java new file mode 100644 index 0000000000000..aefdd6196c25f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgentUpdate.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.v3_2017_03; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An update to an Azure SQL job agent. + */ +public class JobAgentUpdate { + /** + * 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 JobAgentUpdate object itself. + */ + public JobAgentUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgents.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgents.java new file mode 100644 index 0000000000000..02256061c6e62 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobAgents.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobAgentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobAgents. + */ +public interface JobAgents extends SupportsCreating, HasInner { + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName); + + /** + * Gets a list of job agents in 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredential.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredential.java new file mode 100644 index 0000000000000..f1fde039ea826 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredential.java @@ -0,0 +1,115 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobCredentialInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing JobCredential. + */ +public interface JobCredential extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the password value. + */ + String password(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the username value. + */ + String username(); + + /** + * The entirety of the JobCredential definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithPassword, DefinitionStages.WithUsername, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobCredential definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobCredential definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the jobcredential definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + */ + WithPassword withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + + /** + * The stage of the jobcredential definition allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + */ + WithUsername withPassword(String password); + } + + /** + * The stage of the jobcredential definition allowing to specify Username. + */ + interface WithUsername { + /** + * Specifies username. + */ + WithCreate withUsername(String username); + } + + /** + * 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 { + } + } + /** + * The template for a JobCredential update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of JobCredential update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredentials.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredentials.java new file mode 100644 index 0000000000000..ad63fb2128213 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobCredentials.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobCredentialsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobCredentials. + */ +public interface JobCredentials extends SupportsCreating, HasInner { + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionLifecycle.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionLifecycle.java new file mode 100644 index 0000000000000..66eeadca4c184 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionLifecycle.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobExecutionLifecycle. + */ +public final class JobExecutionLifecycle extends ExpandableStringEnum { + /** Static value Created for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CREATED = fromString("Created"); + + /** Static value InProgress for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle IN_PROGRESS = fromString("InProgress"); + + /** Static value WaitingForChildJobExecutions for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_CHILD_JOB_EXECUTIONS = fromString("WaitingForChildJobExecutions"); + + /** Static value WaitingForRetry for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_RETRY = fromString("WaitingForRetry"); + + /** Static value Succeeded for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED = fromString("Succeeded"); + + /** Static value SucceededWithSkipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED_WITH_SKIPPED = fromString("SucceededWithSkipped"); + + /** Static value Failed for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle FAILED = fromString("Failed"); + + /** Static value TimedOut for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle TIMED_OUT = fromString("TimedOut"); + + /** Static value Canceled for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CANCELED = fromString("Canceled"); + + /** Static value Skipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SKIPPED = fromString("Skipped"); + + /** + * Creates or finds a JobExecutionLifecycle from its string representation. + * @param name a name to look for + * @return the corresponding JobExecutionLifecycle + */ + @JsonCreator + public static JobExecutionLifecycle fromString(String name) { + return fromString(name, JobExecutionLifecycle.class); + } + + /** + * @return known JobExecutionLifecycle values + */ + public static Collection values() { + return values(JobExecutionLifecycle.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionTarget.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionTarget.java new file mode 100644 index 0000000000000..baac84c2542c1 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutionTarget.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The target that a job execution is executed on. + */ +public class JobExecutionTarget { + /** + * The type of the target. Possible values include: 'TargetGroup', + * 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private JobTargetType type; + + /** + * The server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * Get the type of the target. Possible values include: 'TargetGroup', 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + * + * @return the type value + */ + public JobTargetType type() { + return this.type; + } + + /** + * Get the server name. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutions.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutions.java new file mode 100644 index 0000000000000..01bef3c34414a --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobExecutions.java @@ -0,0 +1,88 @@ +/** + * 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.v3_2017_03; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgentServerJobExecution; +import rx.Completable; +import java.util.UUID; + +/** + * Type representing JobExecutions. + */ +public interface JobExecutions { + /** + * Begins definition for a new Execution resource. + * @param name resource name. + * @return the first stage of the new Execution definition. + */ + JobAgentServerJobExecution.DefinitionStages.Blank defineExecution(String name); + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName); + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSchedule.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSchedule.java new file mode 100644 index 0000000000000..2edf651ea6d89 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSchedule.java @@ -0,0 +1,149 @@ +/** + * 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.v3_2017_03; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Scheduling properties of a job. + */ +public class JobSchedule { + /** + * Schedule start time. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * Schedule end time. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * Schedule interval type. Possible values include: 'Once', 'Recurring'. + */ + @JsonProperty(value = "type") + private JobScheduleType type; + + /** + * Whether or not the schedule is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Value of the schedule's recurring interval, if the scheduletype is + * recurring. ISO8601 duration format. + */ + @JsonProperty(value = "interval") + private String interval; + + /** + * Get schedule start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set schedule start time. + * + * @param startTime the startTime value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get schedule end time. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set schedule end time. + * + * @param endTime the endTime value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get schedule interval type. Possible values include: 'Once', 'Recurring'. + * + * @return the type value + */ + public JobScheduleType type() { + return this.type; + } + + /** + * Set schedule interval type. Possible values include: 'Once', 'Recurring'. + * + * @param type the type value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withType(JobScheduleType type) { + this.type = type; + return this; + } + + /** + * Get whether or not the schedule is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set whether or not the schedule is enabled. + * + * @param enabled the enabled value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get value of the schedule's recurring interval, if the scheduletype is recurring. ISO8601 duration format. + * + * @return the interval value + */ + public String interval() { + return this.interval; + } + + /** + * Set value of the schedule's recurring interval, if the scheduletype is recurring. ISO8601 duration format. + * + * @param interval the interval value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withInterval(String interval) { + this.interval = interval; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobScheduleType.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobScheduleType.java new file mode 100644 index 0000000000000..088ad3d306acb --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobScheduleType.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobScheduleType. + */ +public enum JobScheduleType { + /** Enum value Once. */ + ONCE("Once"), + + /** Enum value Recurring. */ + RECURRING("Recurring"); + + /** The actual serialized value for a JobScheduleType instance. */ + private String value; + + JobScheduleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobScheduleType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobScheduleType object, or null if unable to parse. + */ + @JsonCreator + public static JobScheduleType fromString(String value) { + JobScheduleType[] items = JobScheduleType.values(); + for (JobScheduleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStep.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStep.java new file mode 100644 index 0000000000000..76b6a5f932122 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStep.java @@ -0,0 +1,204 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobStepInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing JobStep. + */ +public interface JobStep extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the action value. + */ + JobStepAction action(); + + /** + * @return the credential value. + */ + String credential(); + + /** + * @return the executionOptions value. + */ + JobStepExecutionOptions executionOptions(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the output value. + */ + JobStepOutput output(); + + /** + * @return the stepId value. + */ + Integer stepId(); + + /** + * @return the targetGroup value. + */ + String targetGroup(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobStep definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithVersion, DefinitionStages.WithAction, DefinitionStages.WithCredential, DefinitionStages.WithTargetGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobStep definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobStep definition. + */ + interface Blank extends WithVersion { + } + + /** + * The stage of the jobstep definition allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies resourceGroupName, serverName, jobAgentName, jobName. + */ + WithAction withExistingVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName); + } + + /** + * The stage of the jobstep definition allowing to specify Action. + */ + interface WithAction { + /** + * Specifies action. + */ + WithCredential withAction(JobStepAction action); + } + + /** + * The stage of the jobstep definition allowing to specify Credential. + */ + interface WithCredential { + /** + * Specifies credential. + */ + WithTargetGroup withCredential(String credential); + } + + /** + * The stage of the jobstep definition allowing to specify TargetGroup. + */ + interface WithTargetGroup { + /** + * Specifies targetGroup. + */ + WithCreate withTargetGroup(String targetGroup); + } + + /** + * The stage of the jobstep definition allowing to specify ExecutionOptions. + */ + interface WithExecutionOptions { + /** + * Specifies executionOptions. + */ + WithCreate withExecutionOptions(JobStepExecutionOptions executionOptions); + } + + /** + * The stage of the jobstep definition allowing to specify Output. + */ + interface WithOutput { + /** + * Specifies output. + */ + WithCreate withOutput(JobStepOutput output); + } + + /** + * The stage of the jobstep definition allowing to specify StepId. + */ + interface WithStepId { + /** + * Specifies stepId. + */ + WithCreate withStepId(Integer stepId); + } + + /** + * 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.WithExecutionOptions, DefinitionStages.WithOutput, DefinitionStages.WithStepId { + } + } + /** + * The template for a JobStep update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithExecutionOptions, UpdateStages.WithOutput, UpdateStages.WithStepId { + } + + /** + * Grouping of JobStep update stages. + */ + interface UpdateStages { + /** + * The stage of the jobstep update allowing to specify ExecutionOptions. + */ + interface WithExecutionOptions { + /** + * Specifies executionOptions. + */ + Update withExecutionOptions(JobStepExecutionOptions executionOptions); + } + + /** + * The stage of the jobstep update allowing to specify Output. + */ + interface WithOutput { + /** + * Specifies output. + */ + Update withOutput(JobStepOutput output); + } + + /** + * The stage of the jobstep update allowing to specify StepId. + */ + interface WithStepId { + /** + * Specifies stepId. + */ + Update withStepId(Integer stepId); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepAction.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepAction.java new file mode 100644 index 0000000000000..4a886993c77fe --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepAction.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The action to be executed by a job step. + */ +public class JobStepAction { + /** + * Type of action being executed by the job step. Possible values include: + * 'TSql'. + */ + @JsonProperty(value = "type") + private JobStepActionType type; + + /** + * The source of the action to execute. Possible values include: 'Inline'. + */ + @JsonProperty(value = "source") + private JobStepActionSource source; + + /** + * The action value, for example the text of the T-SQL script to execute. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get type of action being executed by the job step. Possible values include: 'TSql'. + * + * @return the type value + */ + public JobStepActionType type() { + return this.type; + } + + /** + * Set type of action being executed by the job step. Possible values include: 'TSql'. + * + * @param type the type value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withType(JobStepActionType type) { + this.type = type; + return this; + } + + /** + * Get the source of the action to execute. Possible values include: 'Inline'. + * + * @return the source value + */ + public JobStepActionSource source() { + return this.source; + } + + /** + * Set the source of the action to execute. Possible values include: 'Inline'. + * + * @param source the source value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withSource(JobStepActionSource source) { + this.source = source; + return this; + } + + /** + * Get the action value, for example the text of the T-SQL script to execute. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the action value, for example the text of the T-SQL script to execute. + * + * @param value the value value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionSource.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionSource.java new file mode 100644 index 0000000000000..27159d6cf8fe9 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionSource.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepActionSource. + */ +public final class JobStepActionSource extends ExpandableStringEnum { + /** Static value Inline for JobStepActionSource. */ + public static final JobStepActionSource INLINE = fromString("Inline"); + + /** + * Creates or finds a JobStepActionSource from its string representation. + * @param name a name to look for + * @return the corresponding JobStepActionSource + */ + @JsonCreator + public static JobStepActionSource fromString(String name) { + return fromString(name, JobStepActionSource.class); + } + + /** + * @return known JobStepActionSource values + */ + public static Collection values() { + return values(JobStepActionSource.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionType.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionType.java new file mode 100644 index 0000000000000..ebb3d859d074e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepActionType.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepActionType. + */ +public final class JobStepActionType extends ExpandableStringEnum { + /** Static value TSql for JobStepActionType. */ + public static final JobStepActionType TSQL = fromString("TSql"); + + /** + * Creates or finds a JobStepActionType from its string representation. + * @param name a name to look for + * @return the corresponding JobStepActionType + */ + @JsonCreator + public static JobStepActionType fromString(String name) { + return fromString(name, JobStepActionType.class); + } + + /** + * @return known JobStepActionType values + */ + public static Collection values() { + return values(JobStepActionType.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutionOptions.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutionOptions.java new file mode 100644 index 0000000000000..95c726f1085aa --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutionOptions.java @@ -0,0 +1,149 @@ +/** + * 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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The execution options of a job step. + */ +public class JobStepExecutionOptions { + /** + * Execution timeout for the job step. + */ + @JsonProperty(value = "timeoutSeconds") + private Integer timeoutSeconds; + + /** + * Maximum number of times the job step will be reattempted if the first + * attempt fails. + */ + @JsonProperty(value = "retryAttempts") + private Integer retryAttempts; + + /** + * Initial delay between retries for job step execution. + */ + @JsonProperty(value = "initialRetryIntervalSeconds") + private Integer initialRetryIntervalSeconds; + + /** + * The maximum amount of time to wait between retries for job step + * execution. + */ + @JsonProperty(value = "maximumRetryIntervalSeconds") + private Integer maximumRetryIntervalSeconds; + + /** + * The backoff multiplier for the time between retries. + */ + @JsonProperty(value = "retryIntervalBackoffMultiplier") + private Double retryIntervalBackoffMultiplier; + + /** + * Get execution timeout for the job step. + * + * @return the timeoutSeconds value + */ + public Integer timeoutSeconds() { + return this.timeoutSeconds; + } + + /** + * Set execution timeout for the job step. + * + * @param timeoutSeconds the timeoutSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withTimeoutSeconds(Integer timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + /** + * Get maximum number of times the job step will be reattempted if the first attempt fails. + * + * @return the retryAttempts value + */ + public Integer retryAttempts() { + return this.retryAttempts; + } + + /** + * Set maximum number of times the job step will be reattempted if the first attempt fails. + * + * @param retryAttempts the retryAttempts value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryAttempts(Integer retryAttempts) { + this.retryAttempts = retryAttempts; + return this; + } + + /** + * Get initial delay between retries for job step execution. + * + * @return the initialRetryIntervalSeconds value + */ + public Integer initialRetryIntervalSeconds() { + return this.initialRetryIntervalSeconds; + } + + /** + * Set initial delay between retries for job step execution. + * + * @param initialRetryIntervalSeconds the initialRetryIntervalSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withInitialRetryIntervalSeconds(Integer initialRetryIntervalSeconds) { + this.initialRetryIntervalSeconds = initialRetryIntervalSeconds; + return this; + } + + /** + * Get the maximum amount of time to wait between retries for job step execution. + * + * @return the maximumRetryIntervalSeconds value + */ + public Integer maximumRetryIntervalSeconds() { + return this.maximumRetryIntervalSeconds; + } + + /** + * Set the maximum amount of time to wait between retries for job step execution. + * + * @param maximumRetryIntervalSeconds the maximumRetryIntervalSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withMaximumRetryIntervalSeconds(Integer maximumRetryIntervalSeconds) { + this.maximumRetryIntervalSeconds = maximumRetryIntervalSeconds; + return this; + } + + /** + * Get the backoff multiplier for the time between retries. + * + * @return the retryIntervalBackoffMultiplier value + */ + public Double retryIntervalBackoffMultiplier() { + return this.retryIntervalBackoffMultiplier; + } + + /** + * Set the backoff multiplier for the time between retries. + * + * @param retryIntervalBackoffMultiplier the retryIntervalBackoffMultiplier value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryIntervalBackoffMultiplier(Double retryIntervalBackoffMultiplier) { + this.retryIntervalBackoffMultiplier = retryIntervalBackoffMultiplier; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutions.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutions.java new file mode 100644 index 0000000000000..25542a849ca4c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepExecutions.java @@ -0,0 +1,45 @@ +/** + * 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.v3_2017_03; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.ExecutionJobJobAgentServerJobExecution; + +/** + * Type representing JobStepExecutions. + */ +public interface JobStepExecutions { + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName); + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutput.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutput.java new file mode 100644 index 0000000000000..68fcd10dd1845 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutput.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.v3_2017_03; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The output configuration of a job step. + */ +public class JobStepOutput { + /** + * The output destination type. Possible values include: 'SqlDatabase'. + */ + @JsonProperty(value = "type") + private JobStepOutputType type; + + /** + * The output destination subscription id. + */ + @JsonProperty(value = "subscriptionId") + private UUID subscriptionId; + + /** + * The output destination resource group. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * The output destination server name. + */ + @JsonProperty(value = "serverName", required = true) + private String serverName; + + /** + * The output destination database. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * The output destination schema. + */ + @JsonProperty(value = "schemaName") + private String schemaName; + + /** + * The output destination table. + */ + @JsonProperty(value = "tableName", required = true) + private String tableName; + + /** + * The resource ID of the credential to use to connect to the output + * destination. + */ + @JsonProperty(value = "credential", required = true) + private String credential; + + /** + * Get the output destination type. Possible values include: 'SqlDatabase'. + * + * @return the type value + */ + public JobStepOutputType type() { + return this.type; + } + + /** + * Set the output destination type. Possible values include: 'SqlDatabase'. + * + * @param type the type value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withType(JobStepOutputType type) { + this.type = type; + return this; + } + + /** + * Get the output destination subscription id. + * + * @return the subscriptionId value + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the output destination subscription id. + * + * @param subscriptionId the subscriptionId value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSubscriptionId(UUID subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the output destination resource group. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the output destination resource group. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the output destination server name. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the output destination server name. + * + * @param serverName the serverName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the output destination database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the output destination database. + * + * @param databaseName the databaseName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the output destination schema. + * + * @return the schemaName value + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the output destination schema. + * + * @param schemaName the schemaName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the output destination table. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the output destination table. + * + * @param tableName the tableName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the resource ID of the credential to use to connect to the output destination. + * + * @return the credential value + */ + public String credential() { + return this.credential; + } + + /** + * Set the resource ID of the credential to use to connect to the output destination. + * + * @param credential the credential value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withCredential(String credential) { + this.credential = credential; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutputType.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutputType.java new file mode 100644 index 0000000000000..348a36efbb3bc --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobStepOutputType.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepOutputType. + */ +public final class JobStepOutputType extends ExpandableStringEnum { + /** Static value SqlDatabase for JobStepOutputType. */ + public static final JobStepOutputType SQL_DATABASE = fromString("SqlDatabase"); + + /** + * Creates or finds a JobStepOutputType from its string representation. + * @param name a name to look for + * @return the corresponding JobStepOutputType + */ + @JsonCreator + public static JobStepOutputType fromString(String name) { + return fromString(name, JobStepOutputType.class); + } + + /** + * @return known JobStepOutputType values + */ + public static Collection values() { + return values(JobStepOutputType.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSteps.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSteps.java new file mode 100644 index 0000000000000..9f90680bb3cd1 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobSteps.java @@ -0,0 +1,86 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobStepsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobSteps. + */ +public interface JobSteps extends SupportsCreating, HasInner { + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName); + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName); + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTarget.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTarget.java new file mode 100644 index 0000000000000..bc07749d6b532 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTarget.java @@ -0,0 +1,204 @@ +/** + * 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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A job target, for example a specific database or a container of databases + * that is evaluated during job execution. + */ +public class JobTarget { + /** + * Whether the target is included or excluded from the group. Possible + * values include: 'Include', 'Exclude'. + */ + @JsonProperty(value = "membershipType") + private JobTargetGroupMembershipType membershipType; + + /** + * The target type. Possible values include: 'TargetGroup', 'SqlDatabase', + * 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + */ + @JsonProperty(value = "type", required = true) + private JobTargetType type; + + /** + * The target server name. + */ + @JsonProperty(value = "serverName") + private String serverName; + + /** + * The target database name. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /** + * The target elastic pool name. + */ + @JsonProperty(value = "elasticPoolName") + private String elasticPoolName; + + /** + * The target shard map. + */ + @JsonProperty(value = "shardMapName") + private String shardMapName; + + /** + * The resource ID of the credential that is used during job execution to + * connect to the target and determine the list of databases inside the + * target. + */ + @JsonProperty(value = "refreshCredential") + private String refreshCredential; + + /** + * Get whether the target is included or excluded from the group. Possible values include: 'Include', 'Exclude'. + * + * @return the membershipType value + */ + public JobTargetGroupMembershipType membershipType() { + return this.membershipType; + } + + /** + * Set whether the target is included or excluded from the group. Possible values include: 'Include', 'Exclude'. + * + * @param membershipType the membershipType value to set + * @return the JobTarget object itself. + */ + public JobTarget withMembershipType(JobTargetGroupMembershipType membershipType) { + this.membershipType = membershipType; + return this; + } + + /** + * Get the target type. Possible values include: 'TargetGroup', 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + * + * @return the type value + */ + public JobTargetType type() { + return this.type; + } + + /** + * Set the target type. Possible values include: 'TargetGroup', 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + * + * @param type the type value to set + * @return the JobTarget object itself. + */ + public JobTarget withType(JobTargetType type) { + this.type = type; + return this; + } + + /** + * Get the target server name. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the target server name. + * + * @param serverName the serverName value to set + * @return the JobTarget object itself. + */ + public JobTarget withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the target database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the target database name. + * + * @param databaseName the databaseName value to set + * @return the JobTarget object itself. + */ + public JobTarget withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the target elastic pool name. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the target elastic pool name. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the JobTarget object itself. + */ + public JobTarget withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the target shard map. + * + * @return the shardMapName value + */ + public String shardMapName() { + return this.shardMapName; + } + + /** + * Set the target shard map. + * + * @param shardMapName the shardMapName value to set + * @return the JobTarget object itself. + */ + public JobTarget withShardMapName(String shardMapName) { + this.shardMapName = shardMapName; + return this; + } + + /** + * Get the resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. + * + * @return the refreshCredential value + */ + public String refreshCredential() { + return this.refreshCredential; + } + + /** + * Set the resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. + * + * @param refreshCredential the refreshCredential value to set + * @return the JobTarget object itself. + */ + public JobTarget withRefreshCredential(String refreshCredential) { + this.refreshCredential = refreshCredential; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetExecutions.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetExecutions.java new file mode 100644 index 0000000000000..51d09bf451780 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetExecutions.java @@ -0,0 +1,61 @@ +/** + * 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.v3_2017_03; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.ExecutionJobJobAgentServerJobExecutionModel; +import java.util.UUID; + +/** + * Type representing JobTargetExecutions. + */ +public interface JobTargetExecutions { + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId); + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName); + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroup.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroup.java new file mode 100644 index 0000000000000..09c08dfed0939 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroup.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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobTargetGroupInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.List; + +/** + * Type representing JobTargetGroup. + */ +public interface JobTargetGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the members value. + */ + List members(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the JobTargetGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithJobAgent, DefinitionStages.WithMembers, DefinitionStages.WithCreate { + } + + /** + * Grouping of JobTargetGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a JobTargetGroup definition. + */ + interface Blank extends WithJobAgent { + } + + /** + * The stage of the jobtargetgroup definition allowing to specify JobAgent. + */ + interface WithJobAgent { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + */ + WithMembers withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + + /** + * The stage of the jobtargetgroup definition allowing to specify Members. + */ + interface WithMembers { + /** + * Specifies members. + */ + WithCreate withMembers(List members); + } + + /** + * 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 { + } + } + /** + * The template for a JobTargetGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithMembers { + } + + /** + * Grouping of JobTargetGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the jobtargetgroup update allowing to specify Members. + */ + interface WithMembers { + /** + * Specifies members. + */ + Update withMembers(List members); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroupMembershipType.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroupMembershipType.java new file mode 100644 index 0000000000000..e8c9f8b391a42 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroupMembershipType.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobTargetGroupMembershipType. + */ +public enum JobTargetGroupMembershipType { + /** Enum value Include. */ + INCLUDE("Include"), + + /** Enum value Exclude. */ + EXCLUDE("Exclude"); + + /** The actual serialized value for a JobTargetGroupMembershipType instance. */ + private String value; + + JobTargetGroupMembershipType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobTargetGroupMembershipType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobTargetGroupMembershipType object, or null if unable to parse. + */ + @JsonCreator + public static JobTargetGroupMembershipType fromString(String value) { + JobTargetGroupMembershipType[] items = JobTargetGroupMembershipType.values(); + for (JobTargetGroupMembershipType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroups.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroups.java new file mode 100644 index 0000000000000..fa054bf295c60 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetGroups.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobTargetGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobTargetGroups. + */ +public interface JobTargetGroups extends SupportsCreating, HasInner { + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetType.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetType.java new file mode 100644 index 0000000000000..dc0283cb0466c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobTargetType.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobTargetType. + */ +public final class JobTargetType extends ExpandableStringEnum { + /** Static value TargetGroup for JobTargetType. */ + public static final JobTargetType TARGET_GROUP = fromString("TargetGroup"); + + /** Static value SqlDatabase for JobTargetType. */ + public static final JobTargetType SQL_DATABASE = fromString("SqlDatabase"); + + /** Static value SqlElasticPool for JobTargetType. */ + public static final JobTargetType SQL_ELASTIC_POOL = fromString("SqlElasticPool"); + + /** Static value SqlShardMap for JobTargetType. */ + public static final JobTargetType SQL_SHARD_MAP = fromString("SqlShardMap"); + + /** Static value SqlServer for JobTargetType. */ + public static final JobTargetType SQL_SERVER = fromString("SqlServer"); + + /** + * Creates or finds a JobTargetType from its string representation. + * @param name a name to look for + * @return the corresponding JobTargetType + */ + @JsonCreator + public static JobTargetType fromString(String name) { + return fromString(name, JobTargetType.class); + } + + /** + * @return known JobTargetType values + */ + public static Collection values() { + return values(JobTargetType.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersion.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersion.java new file mode 100644 index 0000000000000..9de872f7a61c8 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersion.java @@ -0,0 +1,37 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobVersionInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing JobVersion. + */ +public interface JobVersion extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersions.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersions.java new file mode 100644 index 0000000000000..c122170bdaa1a --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/JobVersions.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.v3_2017_03; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobVersionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing JobVersions. + */ +public interface JobVersions extends HasInner { + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Jobs.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Jobs.java new file mode 100644 index 0000000000000..881d49566d91f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Jobs.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.JobsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Jobs. + */ +public interface Jobs extends SupportsCreating, HasInner { + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName); + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackup.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackup.java new file mode 100644 index 0000000000000..bcafdbca04d2a --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackup.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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.LongTermRetentionBackupInner; +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.v3_2017_03.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing LongTermRetentionBackup. + */ +public interface LongTermRetentionBackup 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 name value. + */ + String name(); + + /** + * @return the serverCreateTime value. + */ + DateTime serverCreateTime(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackups.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackups.java new file mode 100644 index 0000000000000..7deeb84fb7b7b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionBackups.java @@ -0,0 +1,74 @@ +/** + * 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.v3_2017_03; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.LongTermRetentionBackupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LongTermRetentionBackups. + */ +public interface LongTermRetentionBackups extends HasInner { + /** + * Lists the long term retention backups for 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); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String locationName, final String longTermRetentionServerName); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionDatabaseState.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionDatabaseState.java new file mode 100644 index 0000000000000..4c834fd67771b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/LongTermRetentionDatabaseState.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LongTermRetentionDatabaseState. + */ +public final class LongTermRetentionDatabaseState extends ExpandableStringEnum { + /** Static value All for LongTermRetentionDatabaseState. */ + public static final LongTermRetentionDatabaseState ALL = fromString("All"); + + /** Static value Live for LongTermRetentionDatabaseState. */ + public static final LongTermRetentionDatabaseState LIVE = fromString("Live"); + + /** Static value Deleted for LongTermRetentionDatabaseState. */ + public static final LongTermRetentionDatabaseState DELETED = fromString("Deleted"); + + /** + * Creates or finds a LongTermRetentionDatabaseState from its string representation. + * @param name a name to look for + * @return the corresponding LongTermRetentionDatabaseState + */ + @JsonCreator + public static LongTermRetentionDatabaseState fromString(String name) { + return fromString(name, LongTermRetentionDatabaseState.class); + } + + /** + * @return known LongTermRetentionDatabaseState values + */ + public static Collection values() { + return values(LongTermRetentionDatabaseState.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicies.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..da04d44423a16 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicies.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ManagedBackupShortTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedBackupShortTermRetentionPolicies. + */ +public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a managed database's short 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicy.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..557c262b5db25 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ManagedBackupShortTermRetentionPolicyInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing ManagedBackupShortTermRetentionPolicy. + */ +public interface ManagedBackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedBackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedBackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedBackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the managedbackupshorttermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * 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 { + } + } + /** + * The template for a ManagedBackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabase.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabase.java new file mode 100644 index 0000000000000..ce2b92bbc0e25 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabase.java @@ -0,0 +1,327 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.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.v3_2017_03.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 name value. + */ + String name(); + + /** + * @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. + */ + WithLocation withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the manageddatabase definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the manageddatabase definition allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the manageddatabase definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the manageddatabase definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(ManagedDatabaseCreateMode createMode); + } + + /** + * The stage of the manageddatabase definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the manageddatabase definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the manageddatabase definition allowing to specify StorageContainerSasToken. + */ + interface WithStorageContainerSasToken { + /** + * Specifies storageContainerSasToken. + */ + WithCreate withStorageContainerSasToken(String storageContainerSasToken); + } + + /** + * The stage of the manageddatabase definition allowing to specify StorageContainerUri. + */ + interface WithStorageContainerUri { + /** + * Specifies storageContainerUri. + */ + WithCreate withStorageContainerUri(String storageContainerUri); + } + + /** + * The stage of the manageddatabase definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + 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.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.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. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the manageddatabase update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the manageddatabase update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(ManagedDatabaseCreateMode createMode); + } + + /** + * The stage of the manageddatabase update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the manageddatabase update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the manageddatabase update allowing to specify StorageContainerSasToken. + */ + interface WithStorageContainerSasToken { + /** + * Specifies storageContainerSasToken. + */ + Update withStorageContainerSasToken(String storageContainerSasToken); + } + + /** + * The stage of the manageddatabase update allowing to specify StorageContainerUri. + */ + interface WithStorageContainerUri { + /** + * Specifies storageContainerUri. + */ + Update withStorageContainerUri(String storageContainerUri); + } + + /** + * The stage of the manageddatabase update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseCreateMode.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseCreateMode.java new file mode 100644 index 0000000000000..b99577bb883a2 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseCreateMode.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.v3_2017_03; + +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"); + + /** + * 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseStatus.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseStatus.java new file mode 100644 index 0000000000000..8d6d98fc0604f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseStatus.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.v3_2017_03; + +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"); + + /** + * 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseUpdate.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseUpdate.java new file mode 100644 index 0000000000000..639b5ca9d2b9e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabaseUpdate.java @@ -0,0 +1,319 @@ +/** + * 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.v3_2017_03; + +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 for the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible'. + */ + @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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + */ + @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; + + /** + * 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; + + /** + * 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 for the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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 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 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabases.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ManagedDatabases.java new file mode 100644 index 0000000000000..f27c700cf2aa1 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/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.v3_2017_03; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabase; +import rx.Completable; +import java.util.UUID; + +/** + * 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 the 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 locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ProvisioningState.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ProvisioningState.java new file mode 100644 index 0000000000000..0d9f8caf6596a --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ProvisioningState.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.v3_2017_03; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** Static value InProgress for ProvisioningState. */ + public static final ProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoint.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoint.java new file mode 100644 index 0000000000000..6c63881c38f32 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoint.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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.RestorePointInner; +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.v3_2017_03.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RestorePoint. + */ +public interface RestorePoint extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the restorePointCreationDate value. + */ + DateTime restorePointCreationDate(); + + /** + * @return the restorePointLabel value. + */ + String restorePointLabel(); + + /** + * @return the restorePointType value. + */ + RestorePointType restorePointType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePointType.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePointType.java new file mode 100644 index 0000000000000..71dd592b70280 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePointType.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RestorePointType. + */ +public enum RestorePointType { + /** Enum value CONTINUOUS. */ + CONTINUOUS("CONTINUOUS"), + + /** Enum value DISCRETE. */ + DISCRETE("DISCRETE"); + + /** The actual serialized value for a RestorePointType instance. */ + private String value; + + RestorePointType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestorePointType instance. + * + * @param value the serialized value to parse. + * @return the parsed RestorePointType object, or null if unable to parse. + */ + @JsonCreator + public static RestorePointType fromString(String value) { + RestorePointType[] items = RestorePointType.values(); + for (RestorePointType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoints.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoints.java new file mode 100644 index 0000000000000..13545d8b4307d --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/RestorePoints.java @@ -0,0 +1,67 @@ +/** + * 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.v3_2017_03; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.RestorePointsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RestorePoints. + */ +public interface RestorePoints extends HasInner { + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/SecurityAlertPolicyState.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..3c33bbddbd47b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/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.v3_2017_03; + +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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTuning.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTuning.java new file mode 100644 index 0000000000000..e7e050656d1ca --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTuning.java @@ -0,0 +1,51 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerAutomaticTuningInner; +import java.util.Map; + +/** + * Type representing ServerAutomaticTuning. + */ +public interface ServerAutomaticTuning extends HasInner, HasManager { + /** + * @return the actualState value. + */ + AutomaticTuningServerMode actualState(); + + /** + * @return the desiredState value. + */ + AutomaticTuningServerMode desiredState(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the options value. + */ + Map options(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTunings.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTunings.java new file mode 100644 index 0000000000000..b3aa1de4dcd9e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerAutomaticTunings.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.v3_2017_03; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerAutomaticTuningInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerAutomaticTuningsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerAutomaticTunings. + */ +public interface ServerAutomaticTunings extends HasInner { + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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); + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicies.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..3b89ec2b3ea8e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicies.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerBlobAuditingPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerBlobAuditingPolicies. + */ +public interface ServerBlobAuditingPolicies extends SupportsCreating, HasInner { + /** + * Gets a server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicy.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..891b388d6ae68 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerBlobAuditingPolicy.java @@ -0,0 +1,277 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerBlobAuditingPolicyInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ServerBlobAuditingPolicy. + */ +public interface ServerBlobAuditingPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the auditActionsAndGroups value. + */ + List auditActionsAndGroups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAzureMonitorTargetEnabled value. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerBlobAuditingPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerBlobAuditingPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerBlobAuditingPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithState withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the serverblobauditingpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ServerBlobAuditingPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ServerBlobAuditingPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the serverblobauditingpolicy update allowing to specify AuditActionsAndGroups. + */ + interface WithAuditActionsAndGroups { + /** + * Specifies auditActionsAndGroups. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify IsAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies isAzureMonitorTargetEnabled. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify IsStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies isStorageSecondaryKeyInUse. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify StorageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies storageAccountSubscriptionId. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + + /** + * The stage of the serverblobauditingpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAlias.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAlias.java new file mode 100644 index 0000000000000..b83b124a56918 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAlias.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerDnsAliasInner; +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.v3_2017_03.implementation.SqlManager; + +/** + * Type representing ServerDnsAlias. + */ +public interface ServerDnsAlias extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the azureDnsRecord value. + */ + String azureDnsRecord(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerDnsAlias definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerDnsAlias definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerDnsAlias definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serverdnsalias definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + + /** + * 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 { + } + } + /** + * The template for a ServerDnsAlias update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ServerDnsAlias update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliasAcquisition.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliasAcquisition.java new file mode 100644 index 0000000000000..f9038687f765c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliasAcquisition.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A server DNS alias acquisition request. + */ +public class ServerDnsAliasAcquisition { + /** + * The id of the server alias that will be acquired to point to this server + * instead. + */ + @JsonProperty(value = "oldServerDnsAliasId") + private String oldServerDnsAliasId; + + /** + * Get the id of the server alias that will be acquired to point to this server instead. + * + * @return the oldServerDnsAliasId value + */ + public String oldServerDnsAliasId() { + return this.oldServerDnsAliasId; + } + + /** + * Set the id of the server alias that will be acquired to point to this server instead. + * + * @param oldServerDnsAliasId the oldServerDnsAliasId value to set + * @return the ServerDnsAliasAcquisition object itself. + */ + public ServerDnsAliasAcquisition withOldServerDnsAliasId(String oldServerDnsAliasId) { + this.oldServerDnsAliasId = oldServerDnsAliasId; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliases.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliases.java new file mode 100644 index 0000000000000..e5268ec5d7a35 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerDnsAliases.java @@ -0,0 +1,64 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerDnsAliasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerDnsAliases. + */ +public interface ServerDnsAliases extends SupportsCreating, HasInner { + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * Gets a list of server DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String dnsAliasName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicies.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..065860cde06bf --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicies.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.v3_2017_03; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerSecurityAlertPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServerSecurityAlertPolicies. + */ +public interface ServerSecurityAlertPolicies extends SupportsCreating, HasInner { + /** + * Get a server'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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicy.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..361b1e3fa9b60 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/ServerSecurityAlertPolicy.java @@ -0,0 +1,251 @@ +/** + * 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.v3_2017_03; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_03.implementation.ServerSecurityAlertPolicyInner; +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.v3_2017_03.implementation.SqlManager; +import java.util.List; + +/** + * Type representing ServerSecurityAlertPolicy. + */ +public interface ServerSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @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 ServerSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerSecurityAlertPolicy definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithState withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serversecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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 ServerSecurityAlertPolicy 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 ServerSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the serversecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the serversecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Sku.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Sku.java new file mode 100644 index 0000000000000..3ceb8c232214b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/Sku.java @@ -0,0 +1,152 @@ +/** + * 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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the 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 if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentPolicyBaselineName.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentPolicyBaselineName.java new file mode 100644 index 0000000000000..88dc038f419b2 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentPolicyBaselineName.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.v3_2017_03; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for VulnerabilityAssessmentPolicyBaselineName. + */ +public enum VulnerabilityAssessmentPolicyBaselineName { + /** Enum value master. */ + MASTER("master"), + + /** Enum value default. */ + DEFAULT("default"); + + /** The actual serialized value for a VulnerabilityAssessmentPolicyBaselineName instance. */ + private String value; + + VulnerabilityAssessmentPolicyBaselineName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a VulnerabilityAssessmentPolicyBaselineName instance. + * + * @param value the serialized value to parse. + * @return the parsed VulnerabilityAssessmentPolicyBaselineName object, or null if unable to parse. + */ + @JsonCreator + public static VulnerabilityAssessmentPolicyBaselineName fromString(String value) { + VulnerabilityAssessmentPolicyBaselineName[] items = VulnerabilityAssessmentPolicyBaselineName.values(); + for (VulnerabilityAssessmentPolicyBaselineName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentRecurringScansProperties.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..47de26dd51dc4 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,98 @@ +/** + * 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.v3_2017_03; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get recurring scans state. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set recurring scans state. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..d3f7d18d13241 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesImpl.java @@ -0,0 +1,67 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.BackupLongTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.BackupLongTermRetentionPolicy; + +class BackupLongTermRetentionPoliciesImpl extends WrapperImpl implements BackupLongTermRetentionPolicies { + private final SqlManager manager; + + BackupLongTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().backupLongTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public BackupLongTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private BackupLongTermRetentionPolicyImpl wrapModel(BackupLongTermRetentionPolicyInner inner) { + return new BackupLongTermRetentionPolicyImpl(inner, manager()); + } + + private BackupLongTermRetentionPolicyImpl wrapModel(String name) { + return new BackupLongTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + BackupLongTermRetentionPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupLongTermRetentionPolicy call(BackupLongTermRetentionPolicyInner inner) { + return new BackupLongTermRetentionPolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + BackupLongTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupLongTermRetentionPolicy call(BackupLongTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..657c84a90765f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPoliciesInner.java @@ -0,0 +1,450 @@ +/** + * 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.v3_2017_03.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BackupLongTermRetentionPolicies. + */ +public class BackupLongTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private BackupLongTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupLongTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackupLongTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(BackupLongTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BackupLongTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface BackupLongTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.BackupLongTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v3_2017_03.BackupLongTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body BackupLongTermRetentionPolicyInner 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.v3_2017_03.BackupLongTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body BackupLongTermRetentionPolicyInner 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.v3_2017_03.BackupLongTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies") + 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); + + } + + /** + * 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).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 serverName The name of the server. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner 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 policyName = "default"; + return service.get(resourceGroupName, serverName, 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 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner 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 policyName = "default"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, 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 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Sets 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 serverName The name of the server. + * @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 serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Sets 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner 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 policyName = "default"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 BackupLongTermRetentionPolicyInner object if successful. + */ + public BackupLongTermRetentionPolicyInner listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).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 serverName The name of the server. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupLongTermRetentionPolicyInner>() { + @Override + public BackupLongTermRetentionPolicyInner 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupLongTermRetentionPolicyInner object + */ + public Observable> listByDatabaseWithServiceResponseAsync(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."); + } + 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 clientResponse = listByDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByDatabaseDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..5b713502c1c42 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.BackupLongTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class BackupLongTermRetentionPolicyImpl extends CreatableUpdatableImpl implements BackupLongTermRetentionPolicy, BackupLongTermRetentionPolicy.Definition, BackupLongTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + BackupLongTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new BackupLongTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + BackupLongTermRetentionPolicyImpl(BackupLongTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackupLongTermRetentionPoliciesInner client = this.manager().inner().backupLongTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, 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 BackupLongTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withMonthlyRetention(String monthlyRetention) { + this.inner().withMonthlyRetention(monthlyRetention); + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withWeeklyRetention(String weeklyRetention) { + this.inner().withWeeklyRetention(weeklyRetention); + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withWeekOfYear(Integer weekOfYear) { + this.inner().withWeekOfYear(weekOfYear); + return this; + } + + @Override + public BackupLongTermRetentionPolicyImpl withYearlyRetention(String yearlyRetention) { + this.inner().withYearlyRetention(yearlyRetention); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..22d2eaf85f9e6 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/BackupLongTermRetentionPolicyInner.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.v3_2017_03.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 BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner 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 BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..aa2f1acc65178 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseBlobAuditingPolicy; + +class DatabaseBlobAuditingPoliciesImpl extends WrapperImpl implements DatabaseBlobAuditingPolicies { + private final SqlManager manager; + + DatabaseBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private DatabaseBlobAuditingPolicyImpl wrapModel(DatabaseBlobAuditingPolicyInner inner) { + return new DatabaseBlobAuditingPolicyImpl(inner, manager()); + } + + private DatabaseBlobAuditingPolicyImpl wrapModel(String name) { + return new DatabaseBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseBlobAuditingPolicy call(DatabaseBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..0688287b47342 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v3_2017_03.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseBlobAuditingPolicies. + */ +public class DatabaseBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.DatabaseBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v3_2017_03.DatabaseBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body DatabaseBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's blob auditing 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. + * @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 DatabaseBlobAuditingPolicyInner object if successful. + */ + public DatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's blob auditing 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. + * @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 blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseBlobAuditingPolicyInner>() { + @Override + public DatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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 blob auditing 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. + * @param parameters The database blob auditing 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 DatabaseBlobAuditingPolicyInner object if successful. + */ + public DatabaseBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing 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, DatabaseBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseBlobAuditingPolicyInner>() { + @Override + public DatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's blob auditing 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. + * @param parameters The database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseBlobAuditingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..e3b995940e5f5 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,191 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class DatabaseBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements DatabaseBlobAuditingPolicy, DatabaseBlobAuditingPolicy.Definition, DatabaseBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new DatabaseBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseBlobAuditingPolicyImpl(DatabaseBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseBlobAuditingPoliciesInner client = this.manager().inner().databaseBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseBlobAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public DatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..e9a850200ce7b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,443 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database blob auditing policy. + */ +@JsonFlatten +public class DatabaseBlobAuditingPolicyInner extends ProxyResource { + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..5e4533dca2a1e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -0,0 +1,140 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.VulnerabilityAssessmentRecurringScansProperties; + +class DatabaseVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessment, DatabaseVulnerabilityAssessment.Definition, DatabaseVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseVulnerabilityAssessmentImpl(DatabaseVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + DatabaseVulnerabilityAssessmentsInner client = this.manager().inner().databaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseVulnerabilityAssessmentsInner client = this.manager().inner().databaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentsInner client = this.manager().inner().databaseVulnerabilityAssessments(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @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 VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..d49923d99ef9e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentInner.java @@ -0,0 +1,132 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if + * server level vulnerability assessment policy doesn't set. + */ + @JsonProperty(value = "properties.storageContainerPath") + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..00f9c676e5030 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,120 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v3_2017_03.VulnerabilityAssessmentPolicyBaselineName; + +class DatabaseVulnerabilityAssessmentRuleBaselineImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessmentRuleBaseline, DatabaseVulnerabilityAssessmentRuleBaseline.Definition, DatabaseVulnerabilityAssessmentRuleBaseline.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String ruleId; + private VulnerabilityAssessmentPolicyBaselineName baselineName; + private List cbaselineResults; + private List ubaselineResults; + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentRuleBaselineInner()); + this.manager = manager; + // Set resource name + this.baselineName = name; + // + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(DatabaseVulnerabilityAssessmentRuleBaselineInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.baselineName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.ruleId = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + this.baselineName = IdParsingUtils.getValueFromIdByName(inner.id(), "baselines"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().databaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ruleId, this.baselineName, this.cbaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().databaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ruleId, this.baselineName, this.ubaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().databaseVulnerabilityAssessmentRuleBaselines(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.ruleId, this.baselineName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List baselineResults() { + return this.inner().baselineResults(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withExistingRule(String resourceGroupName, String serverName, String databaseName, String ruleId) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.ruleId = ruleId; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withBaselineResults(List baselineResults) { + if (isInCreateMode()) { + this.cbaselineResults = baselineResults; + } else { + this.ubaselineResults = baselineResults; + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..78454f4d4b312 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java @@ -0,0 +1,48 @@ +/** + * 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.v3_2017_03.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment rule baseline. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /** + * The rule baseline result. + */ + @JsonProperty(value = "properties.baselineResults", required = true) + private List baselineResults; + + /** + * Get the rule baseline result. + * + * @return the baselineResults value + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the rule baseline result. + * + * @param baselineResults the baselineResults value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults(List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..c9c97ed964261 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,72 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselines; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaseline; +import rx.Completable; + +class DatabaseVulnerabilityAssessmentRuleBaselinesImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentRuleBaselines { + private final SqlManager manager; + + DatabaseVulnerabilityAssessmentRuleBaselinesImpl(SqlManager manager) { + super(manager.inner().databaseVulnerabilityAssessmentRuleBaselines()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl defineBaseline(String name) { + return wrapBaselineModel(name); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapBaselineModel(String name) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentRuleBaselineInnerUsingDatabaseVulnerabilityAssessmentRuleBaselinesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String ruleId = IdParsingUtils.getValueFromIdByName(id, "rules"); + String baselineName = IdParsingUtils.getValueFromIdByName(id, "baselines"); + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaseline call(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java new file mode 100644 index 0000000000000..e83ee5b4d401c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java @@ -0,0 +1,408 @@ +/** + * 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.v3_2017_03.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v3_2017_03.VulnerabilityAssessmentPolicyBaselineName; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseVulnerabilityAssessmentRuleBaselines. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentRuleBaselinesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentRuleBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentRuleBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessmentRuleBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @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.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner get(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName, baselineResults).toBlocking().single().body(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName, baselineResults), serviceCallback); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName, baselineResults).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 (baselineResults == null) { + throw new IllegalArgumentException("Parameter baselineResults is required and cannot be null."); + } + Validator.validate(baselineResults); + final String vulnerabilityAssessmentName = "default"; + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + parameters.withBaselineResults(baselineResults); + return service.createOrUpdate(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 = 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..8a15c023320f7 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessments; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessment; + +class DatabaseVulnerabilityAssessmentsImpl extends WrapperImpl implements DatabaseVulnerabilityAssessments { + private final SqlManager manager; + + DatabaseVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().databaseVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl define(String name) { + return wrapModel(name); + } + + private DatabaseVulnerabilityAssessmentImpl wrapModel(DatabaseVulnerabilityAssessmentInner inner) { + return new DatabaseVulnerabilityAssessmentImpl(inner, manager()); + } + + private DatabaseVulnerabilityAssessmentImpl wrapModel(String name) { + return new DatabaseVulnerabilityAssessmentImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseVulnerabilityAssessmentsInner 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 DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..3f4162b476f57 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/DatabaseVulnerabilityAssessmentsInner.java @@ -0,0 +1,618 @@ +/** + * 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.v3_2017_03.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 DatabaseVulnerabilityAssessments. + */ +public class DatabaseVulnerabilityAssessmentsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2017_03.DatabaseVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body DatabaseVulnerabilityAssessmentInner 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.v3_2017_03.DatabaseVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2017_03.DatabaseVulnerabilityAssessments listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments") + 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.v3_2017_03.DatabaseVulnerabilityAssessments listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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 database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested 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 serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String serverName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment 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 deleteAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are 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<DatabaseVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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 for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with a 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database for which the vulnerability assessment policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseVulnerabilityAssessmentInner> 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); + } + + /** + * Lists the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessment policies associated with a 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 the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessment policies associated with a 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<DatabaseVulnerabilityAssessmentInner> 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionImpl.java new file mode 100644 index 0000000000000..bb0144d15a44b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ExecutionJobJobAgentServerJobExecution; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v3_2017_03.ProvisioningState; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionTarget; + +class ExecutionJobJobAgentServerJobExecutionImpl extends IndexableRefreshableWrapperImpl implements ExecutionJobJobAgentServerJobExecution { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private UUID jobExecutionId; + private String stepName; + + ExecutionJobJobAgentServerJobExecutionImpl(JobExecutionInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.jobExecutionId = IdParsingUtils.getValueFromIdByName(inner.id(), "executions"); + this.stepName = IdParsingUtils.getValueFromIdByName(inner.id(), "steps"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + JobStepExecutionsInner client = this.manager().inner().jobStepExecutions(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobExecutionId, this.stepName); + } + + + + @Override + public DateTime createTime() { + return this.inner().createTime(); + } + + @Override + public Integer currentAttempts() { + return this.inner().currentAttempts(); + } + + @Override + public DateTime currentAttemptStartTime() { + return this.inner().currentAttemptStartTime(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public UUID jobExecutionId() { + return this.inner().jobExecutionId(); + } + + @Override + public Integer jobVersion() { + return this.inner().jobVersion(); + } + + @Override + public String lastMessage() { + return this.inner().lastMessage(); + } + + @Override + public JobExecutionLifecycle lifecycle() { + return this.inner().lifecycle(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String stepName() { + return this.inner().stepName(); + } + + @Override + public JobExecutionTarget target() { + return this.inner().target(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java new file mode 100644 index 0000000000000..8badfbe476f17 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExecutionJobJobAgentServerJobExecutionModelImpl.java @@ -0,0 +1,115 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ExecutionJobJobAgentServerJobExecutionModel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v3_2017_03.ProvisioningState; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionTarget; + +class ExecutionJobJobAgentServerJobExecutionModelImpl extends WrapperImpl implements ExecutionJobJobAgentServerJobExecutionModel { + private final SqlManager manager; + + ExecutionJobJobAgentServerJobExecutionModelImpl(JobExecutionInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime createTime() { + return this.inner().createTime(); + } + + @Override + public Integer currentAttempts() { + return this.inner().currentAttempts(); + } + + @Override + public DateTime currentAttemptStartTime() { + return this.inner().currentAttemptStartTime(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public UUID jobExecutionId() { + return this.inner().jobExecutionId(); + } + + @Override + public Integer jobVersion() { + return this.inner().jobVersion(); + } + + @Override + public String lastMessage() { + return this.inner().lastMessage(); + } + + @Override + public JobExecutionLifecycle lifecycle() { + return this.inner().lifecycle(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String stepName() { + return this.inner().stepName(); + } + + @Override + public JobExecutionTarget target() { + return this.inner().target(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..823d1b611bd36 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedDatabaseBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedDatabaseBlobAuditingPolicy; + +class ExtendedDatabaseBlobAuditingPoliciesImpl extends WrapperImpl implements ExtendedDatabaseBlobAuditingPolicies { + private final SqlManager manager; + + ExtendedDatabaseBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().extendedDatabaseBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private ExtendedDatabaseBlobAuditingPolicyImpl wrapModel(ExtendedDatabaseBlobAuditingPolicyInner inner) { + return new ExtendedDatabaseBlobAuditingPolicyImpl(inner, manager()); + } + + private ExtendedDatabaseBlobAuditingPolicyImpl wrapModel(String name) { + return new ExtendedDatabaseBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public ExtendedDatabaseBlobAuditingPolicy call(ExtendedDatabaseBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..5a45c8fb14693 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v3_2017_03.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ExtendedDatabaseBlobAuditingPolicies. + */ +public class ExtendedDatabaseBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ExtendedDatabaseBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedDatabaseBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ExtendedDatabaseBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ExtendedDatabaseBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ExtendedDatabaseBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ExtendedDatabaseBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ExtendedDatabaseBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v3_2017_03.ExtendedDatabaseBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ExtendedDatabaseBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an extended database's blob auditing 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. + * @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 ExtendedDatabaseBlobAuditingPolicyInner object if successful. + */ + public ExtendedDatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets an extended database's blob auditing 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. + * @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 an extended database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, ExtendedDatabaseBlobAuditingPolicyInner>() { + @Override + public ExtendedDatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an extended database's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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 an extended database's blob auditing 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. + * @param parameters The extended database blob auditing 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 ExtendedDatabaseBlobAuditingPolicyInner object if successful. + */ + public ExtendedDatabaseBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an extended database's blob auditing 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. + * @param parameters The extended database blob auditing 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, ExtendedDatabaseBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates an extended database's blob auditing 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. + * @param parameters The extended database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ExtendedDatabaseBlobAuditingPolicyInner>() { + @Override + public ExtendedDatabaseBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an extended database's blob auditing 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. + * @param parameters The extended database blob auditing policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExtendedDatabaseBlobAuditingPolicyInner 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 blobAuditingPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..b6d26a34208be --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,197 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedDatabaseBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class ExtendedDatabaseBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements ExtendedDatabaseBlobAuditingPolicy, ExtendedDatabaseBlobAuditingPolicy.Definition, ExtendedDatabaseBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + ExtendedDatabaseBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new ExtendedDatabaseBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ExtendedDatabaseBlobAuditingPolicyImpl(ExtendedDatabaseBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String predicateExpression() { + return this.inner().predicateExpression(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.inner().withPredicateExpression(predicateExpression); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..23c823617476e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedDatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,454 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An extended database blob auditing policy. + */ +@JsonFlatten +public class ExtendedDatabaseBlobAuditingPolicyInner extends ProxyResource { + /** + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "properties.predicateExpression") + private String predicateExpression; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..398056f4c2bed --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedServerBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedServerBlobAuditingPolicy; + +class ExtendedServerBlobAuditingPoliciesImpl extends WrapperImpl implements ExtendedServerBlobAuditingPolicies { + private final SqlManager manager; + + ExtendedServerBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().extendedServerBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private ExtendedServerBlobAuditingPolicyImpl wrapModel(ExtendedServerBlobAuditingPolicyInner inner) { + return new ExtendedServerBlobAuditingPolicyImpl(inner, manager()); + } + + private ExtendedServerBlobAuditingPolicyImpl wrapModel(String name) { + return new ExtendedServerBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ExtendedServerBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ExtendedServerBlobAuditingPolicy call(ExtendedServerBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..d72c14bea8a45 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.v3_2017_03.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ExtendedServerBlobAuditingPolicies. + */ +public class ExtendedServerBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ExtendedServerBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedServerBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ExtendedServerBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ExtendedServerBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ExtendedServerBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ExtendedServerBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ExtendedServerBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v3_2017_03.ExtendedServerBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ExtendedServerBlobAuditingPolicyInner 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.v3_2017_03.ExtendedServerBlobAuditingPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ExtendedServerBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an extended server's blob auditing 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. + * @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 ExtendedServerBlobAuditingPolicyInner object if successful. + */ + public ExtendedServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets an extended server's blob auditing 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 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 an extended server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ExtendedServerBlobAuditingPolicyInner>() { + @Override + public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an extended server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, blobAuditingPolicyName, 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 an extended server's blob auditing 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 parameters Properties of extended blob auditing 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 ExtendedServerBlobAuditingPolicyInner object if successful. + */ + public ExtendedServerBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing 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, ExtendedServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ExtendedServerBlobAuditingPolicyInner>() { + @Override + public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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 extended server's blob auditing 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 parameters Properties of extended blob auditing 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 ExtendedServerBlobAuditingPolicyInner object if successful. + */ + public ExtendedServerBlobAuditingPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ExtendedServerBlobAuditingPolicyInner>() { + @Override + public ExtendedServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an extended server's blob auditing 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 parameters Properties of extended blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedServerBlobAuditingPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..3b87eeb0388c9 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyImpl.java @@ -0,0 +1,194 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedServerBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class ExtendedServerBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements ExtendedServerBlobAuditingPolicy, ExtendedServerBlobAuditingPolicy.Definition, ExtendedServerBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ExtendedServerBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new ExtendedServerBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ExtendedServerBlobAuditingPolicyImpl(ExtendedServerBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ExtendedServerBlobAuditingPoliciesInner client = this.manager().inner().extendedServerBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ExtendedServerBlobAuditingPoliciesInner client = this.manager().inner().extendedServerBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ExtendedServerBlobAuditingPoliciesInner client = this.manager().inner().extendedServerBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String predicateExpression() { + return this.inner().predicateExpression(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.inner().withPredicateExpression(predicateExpression); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public ExtendedServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..09b0e3ad121b0 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ExtendedServerBlobAuditingPolicyInner.java @@ -0,0 +1,454 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An extended server blob auditing policy. + */ +@JsonFlatten +public class ExtendedServerBlobAuditingPolicyInner extends ProxyResource { + /** + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "properties.predicateExpression") + private String predicateExpression; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/IdParsingUtils.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..0e91afdaf75f2 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v3_2017_03.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentImpl.java new file mode 100644 index 0000000000000..6c7e1e3c43fa7 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentImpl.java @@ -0,0 +1,146 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobAgent; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2017_03.Sku; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgentState; + +class JobAgentImpl extends CreatableUpdatableImpl implements JobAgent, JobAgent.Definition, JobAgent.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + + JobAgentImpl(String name, SqlManager manager) { + super(name, new JobAgentInner()); + this.manager = manager; + // Set resource name + this.jobAgentName = name; + // + } + + JobAgentImpl(JobAgentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.jobAgentName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobAgentsInner client = this.manager().inner().jobAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobAgentsInner client = this.manager().inner().jobAgents(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobAgentsInner client = this.manager().inner().jobAgents(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String databaseId() { + return this.inner().databaseId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public JobAgentState state() { + return this.inner().state(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public JobAgentImpl withDatabaseId(String databaseId) { + this.inner().withDatabaseId(databaseId); + return this; + } + + @Override + public JobAgentImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public JobAgentImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + + @Override + public JobAgentImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentInner.java new file mode 100644 index 0000000000000..6fc5029004c4f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentInner.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.Sku; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL job agent. + */ +@JsonFlatten +public class JobAgentInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Resource ID of the database to store job metadata in. + */ + @JsonProperty(value = "properties.databaseId", required = true) + private String databaseId; + + /** + * The state of the job agent. Possible values include: 'Creating', + * 'Ready', 'Updating', 'Deleting', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private JobAgentState state; + + /** + * 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 JobAgentInner object itself. + */ + public JobAgentInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get resource ID of the database to store job metadata in. + * + * @return the databaseId value + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Set resource ID of the database to store job metadata in. + * + * @param databaseId the databaseId value to set + * @return the JobAgentInner object itself. + */ + public JobAgentInner withDatabaseId(String databaseId) { + this.databaseId = databaseId; + return this; + } + + /** + * Get the state of the job agent. Possible values include: 'Creating', 'Ready', 'Updating', 'Deleting', 'Disabled'. + * + * @return the state value + */ + public JobAgentState state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentServerJobExecutionImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentServerJobExecutionImpl.java new file mode 100644 index 0000000000000..a4077273bf682 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentServerJobExecutionImpl.java @@ -0,0 +1,170 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobAgentServerJobExecution; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.UUID; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v3_2017_03.ProvisioningState; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionTarget; + +class JobAgentServerJobExecutionImpl extends CreatableUpdatableImpl implements JobAgentServerJobExecution, JobAgentServerJobExecution.Definition, JobAgentServerJobExecution.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private UUID jobExecutionId; + + JobAgentServerJobExecutionImpl(String name, SqlManager manager) { + super(name, new JobExecutionInner()); + this.manager = manager; + // Set resource name + this.jobExecutionId = name; + // + } + + JobAgentServerJobExecutionImpl(JobExecutionInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.jobExecutionId = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.jobExecutionId = IdParsingUtils.getValueFromIdByName(inner.id(), "executions"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobExecutionsInner client = this.manager().inner().jobExecutions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobExecutionId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobExecutionsInner client = this.manager().inner().jobExecutions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobExecutionId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobExecutionsInner client = this.manager().inner().jobExecutions(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createTime() { + return this.inner().createTime(); + } + + @Override + public Integer currentAttempts() { + return this.inner().currentAttempts(); + } + + @Override + public DateTime currentAttemptStartTime() { + return this.inner().currentAttemptStartTime(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public UUID jobExecutionId() { + return this.inner().jobExecutionId(); + } + + @Override + public Integer jobVersion() { + return this.inner().jobVersion(); + } + + @Override + public String lastMessage() { + return this.inner().lastMessage(); + } + + @Override + public JobExecutionLifecycle lifecycle() { + return this.inner().lifecycle(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String stepName() { + return this.inner().stepName(); + } + + @Override + public JobExecutionTarget target() { + return this.inner().target(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobAgentServerJobExecutionImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + this.jobName = jobName; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsImpl.java new file mode 100644 index 0000000000000..a484ca8413f66 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgents; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgent; + +class JobAgentsImpl extends WrapperImpl implements JobAgents { + private final SqlManager manager; + + JobAgentsImpl(SqlManager manager) { + super(manager.inner().jobAgents()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobAgentImpl define(String name) { + return wrapModel(name); + } + + private JobAgentImpl wrapModel(JobAgentInner inner) { + return new JobAgentImpl(inner, manager()); + } + + private JobAgentImpl wrapModel(String name) { + return new JobAgentImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + JobAgentsInner 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 JobAgent call(JobAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName) { + JobAgentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1() { + @Override + public JobAgent call(JobAgentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + JobAgentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsInner.java new file mode 100644 index 0000000000000..434d156dd5674 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobAgentsInner.java @@ -0,0 +1,1139 @@ +/** + * 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.v3_2017_03.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.v3_2017_03.JobAgentUpdate; +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 JobAgents. + */ +public class JobAgentsInner { + /** The Retrofit service to perform REST calls. */ + private JobAgentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobAgentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobAgentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobAgentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobAgents to be + * used by Retrofit to perform actually REST calls. + */ + interface JobAgentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobAgents listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents") + 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.v3_2017_03.JobAgents get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v3_2017_03.JobAgents createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Body JobAgentInner 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.v3_2017_03.JobAgents beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Body JobAgentInner 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.v3_2017_03.JobAgents delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v3_2017_03.JobAgents beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v3_2017_03.JobAgents update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobAgentUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobAgents beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobAgentUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobAgents listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of job agents in 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<JobAgentInner> 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 job agents in 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 a list of job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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 a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner get(String resourceGroupName, String serverName, String jobAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 getAsync(String resourceGroupName, String serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 serverName, String jobAgentName, JobAgentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters), serviceCallback); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent 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 serverName, String jobAgentName, JobAgentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters), serviceCallback); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().last().body(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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, jobAgentName, 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 job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().last().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String jobAgentName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(null); + Observable> observable = service.update(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).toBlocking().last().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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); + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(tags); + Observable> observable = service.update(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner beginUpdate(String resourceGroupName, String serverName, String jobAgentName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(null); + return service.beginUpdate(resourceGroupName, serverName, jobAgentName, 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 a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 JobAgentInner object if successful. + */ + public JobAgentInner beginUpdate(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).toBlocking().single().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent 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 serverName, String jobAgentName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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); + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(tags); + return service.beginUpdate(resourceGroupName, serverName, jobAgentName, 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 job agents in 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<JobAgentInner> 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 job agents in 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 a list of job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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 job agents in 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<JobAgentInner> 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialImpl.java new file mode 100644 index 0000000000000..1a8a718c6b1fb --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialImpl.java @@ -0,0 +1,119 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobCredential; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class JobCredentialImpl extends CreatableUpdatableImpl implements JobCredential, JobCredential.Definition, JobCredential.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String credentialName; + + JobCredentialImpl(String name, SqlManager manager) { + super(name, new JobCredentialInner()); + this.manager = manager; + // Set resource name + this.credentialName = name; + // + } + + JobCredentialImpl(JobCredentialInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.credentialName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.credentialName = IdParsingUtils.getValueFromIdByName(inner.id(), "credentials"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobCredentialsInner client = this.manager().inner().jobCredentials(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.credentialName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobCredentialsInner client = this.manager().inner().jobCredentials(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.credentialName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobCredentialsInner client = this.manager().inner().jobCredentials(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.credentialName); + } + + @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 String password() { + return this.inner().password(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String username() { + return this.inner().username(); + } + + @Override + public JobCredentialImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + @Override + public JobCredentialImpl withPassword(String password) { + this.inner().withPassword(password); + return this; + } + + @Override + public JobCredentialImpl withUsername(String username) { + this.inner().withUsername(username); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialInner.java new file mode 100644 index 0000000000000..cf3c1a809561d --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialInner.java @@ -0,0 +1,73 @@ +/** + * 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.v3_2017_03.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A stored credential that can be used by a job to connect to target + * databases. + */ +@JsonFlatten +public class JobCredentialInner extends ProxyResource { + /** + * The credential user name. + */ + @JsonProperty(value = "properties.username", required = true) + private String username; + + /** + * The credential password. + */ + @JsonProperty(value = "properties.password", required = true) + private String password; + + /** + * Get the credential user name. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set the credential user name. + * + * @param username the username value to set + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the credential password. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the credential password. + * + * @param password the password value to set + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsImpl.java new file mode 100644 index 0000000000000..ee76bf8e310d0 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobCredentials; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.JobCredential; + +class JobCredentialsImpl extends WrapperImpl implements JobCredentials { + private final SqlManager manager; + + JobCredentialsImpl(SqlManager manager) { + super(manager.inner().jobCredentials()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobCredentialImpl define(String name) { + return wrapModel(name); + } + + private JobCredentialImpl wrapModel(JobCredentialInner inner) { + return new JobCredentialImpl(inner, manager()); + } + + private JobCredentialImpl wrapModel(String name) { + return new JobCredentialImpl(name, this.manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobCredentialsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobCredential call(JobCredentialInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + JobCredentialsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, credentialName) + .map(new Func1() { + @Override + public JobCredential call(JobCredentialInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + JobCredentialsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, credentialName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsInner.java new file mode 100644 index 0000000000000..93cda2612c2c0 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobCredentialsInner.java @@ -0,0 +1,637 @@ +/** + * 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.v3_2017_03.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 JobCredentials. + */ +public class JobCredentialsInner { + /** The Retrofit service to perform REST calls. */ + private JobCredentialsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobCredentialsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobCredentialsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobCredentialsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobCredentials to be + * used by Retrofit to perform actually REST calls. + */ + interface JobCredentialsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobCredentials listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v3_2017_03.JobCredentials get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @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.v3_2017_03.JobCredentials createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @Path("subscriptionId") String subscriptionId, @Body JobCredentialInner 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.v3_2017_03.JobCredentials delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @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.v3_2017_03.JobCredentials listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobCredentialInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobCredentialInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, 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 = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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 jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 JobCredentialInner object if successful. + */ + public JobCredentialInner get(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).toBlocking().single().body(); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobAgentName, String credentialName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName), serviceCallback); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1, JobCredentialInner>() { + @Override + public JobCredentialInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName 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, jobAgentName, credentialName, 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 job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential 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 JobCredentialInner object if successful. + */ + public JobCredentialInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential 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 serverName, String jobAgentName, String credentialName, JobCredentialInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters), serviceCallback); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).map(new Func1, JobCredentialInner>() { + @Override + public JobCredentialInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, credentialName, 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 a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobAgentName, String credentialName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).toBlocking().single().body(); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 jobAgentName, String credentialName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName), serviceCallback); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName 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.delete(resourceGroupName, serverName, jobAgentName, credentialName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of jobs credentials. + * + * @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<JobCredentialInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs credentials. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs credentials. + * + * @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<JobCredentialInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + * @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<JobCredentialInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobCredentialInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionInner.java new file mode 100644 index 0000000000000..ffeace7b2538f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionInner.java @@ -0,0 +1,235 @@ +/** + * 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.v3_2017_03.implementation; + +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.v3_2017_03.ProvisioningState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutionTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An execution of a job. + */ +@JsonFlatten +public class JobExecutionInner extends ProxyResource { + /** + * The job version number. + */ + @JsonProperty(value = "properties.jobVersion", access = JsonProperty.Access.WRITE_ONLY) + private Integer jobVersion; + + /** + * The job step name. + */ + @JsonProperty(value = "properties.stepName", access = JsonProperty.Access.WRITE_ONLY) + private String stepName; + + /** + * The job step id. + */ + @JsonProperty(value = "properties.stepId", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepId; + + /** + * The unique identifier of the job execution. + */ + @JsonProperty(value = "properties.jobExecutionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID jobExecutionId; + + /** + * The detailed state of the job execution. Possible values include: + * 'Created', 'InProgress', 'WaitingForChildJobExecutions', + * 'WaitingForRetry', 'Succeeded', 'SucceededWithSkipped', 'Failed', + * 'TimedOut', 'Canceled', 'Skipped'. + */ + @JsonProperty(value = "properties.lifecycle", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionLifecycle lifecycle; + + /** + * The ARM provisioning state of the job execution. Possible values + * include: 'Created', 'InProgress', 'Succeeded', 'Failed', 'Canceled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The time that the job execution was created. + */ + @JsonProperty(value = "properties.createTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createTime; + + /** + * The time that the job execution started. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The time that the job execution completed. + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * Number of times the job execution has been attempted. + */ + @JsonProperty(value = "properties.currentAttempts") + private Integer currentAttempts; + + /** + * Start time of the current attempt. + */ + @JsonProperty(value = "properties.currentAttemptStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime currentAttemptStartTime; + + /** + * The last status or error message. + */ + @JsonProperty(value = "properties.lastMessage", access = JsonProperty.Access.WRITE_ONLY) + private String lastMessage; + + /** + * The target that this execution is executed on. + */ + @JsonProperty(value = "properties.target", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionTarget target; + + /** + * Get the job version number. + * + * @return the jobVersion value + */ + public Integer jobVersion() { + return this.jobVersion; + } + + /** + * Get the job step name. + * + * @return the stepName value + */ + public String stepName() { + return this.stepName; + } + + /** + * Get the job step id. + * + * @return the stepId value + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Get the unique identifier of the job execution. + * + * @return the jobExecutionId value + */ + public UUID jobExecutionId() { + return this.jobExecutionId; + } + + /** + * Get the detailed state of the job execution. Possible values include: 'Created', 'InProgress', 'WaitingForChildJobExecutions', 'WaitingForRetry', 'Succeeded', 'SucceededWithSkipped', 'Failed', 'TimedOut', 'Canceled', 'Skipped'. + * + * @return the lifecycle value + */ + public JobExecutionLifecycle lifecycle() { + return this.lifecycle; + } + + /** + * Get the ARM provisioning state of the job execution. Possible values include: 'Created', 'InProgress', 'Succeeded', 'Failed', 'Canceled'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the time that the job execution was created. + * + * @return the createTime value + */ + public DateTime createTime() { + return this.createTime; + } + + /** + * Get the time that the job execution started. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the time that the job execution completed. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get number of times the job execution has been attempted. + * + * @return the currentAttempts value + */ + public Integer currentAttempts() { + return this.currentAttempts; + } + + /** + * Set number of times the job execution has been attempted. + * + * @param currentAttempts the currentAttempts value to set + * @return the JobExecutionInner object itself. + */ + public JobExecutionInner withCurrentAttempts(Integer currentAttempts) { + this.currentAttempts = currentAttempts; + return this; + } + + /** + * Get start time of the current attempt. + * + * @return the currentAttemptStartTime value + */ + public DateTime currentAttemptStartTime() { + return this.currentAttemptStartTime; + } + + /** + * Get the last status or error message. + * + * @return the lastMessage value + */ + public String lastMessage() { + return this.lastMessage; + } + + /** + * Get the target that this execution is executed on. + * + * @return the target value + */ + public JobExecutionTarget target() { + return this.target; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsImpl.java new file mode 100644 index 0000000000000..9204ee9827d0e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsImpl.java @@ -0,0 +1,112 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgentServerJobExecution; +import rx.Completable; +import java.util.UUID; + +class JobExecutionsImpl extends WrapperImpl implements JobExecutions { + private final SqlManager manager; + + JobExecutionsImpl(SqlManager manager) { + super(manager.inner().jobExecutions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobAgentServerJobExecutionImpl defineExecution(String name) { + return wrapExecutionModel(name); + } + + private JobAgentServerJobExecutionImpl wrapExecutionModel(String name) { + return new JobAgentServerJobExecutionImpl(name, this.manager()); + } + + private JobAgentServerJobExecutionImpl wrapJobAgentServerJobExecutionModel(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobExecutionsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return wrapJobAgentServerJobExecutionModel(inner); + } + }); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toCompletable(); + } + + @Override + public Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + JobExecutionsInner client = this.inner(); + return client.listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobExecutionsInner client = this.inner(); + return client.createAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsInner.java new file mode 100644 index 0000000000000..82ff3d7b9127f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobExecutionsInner.java @@ -0,0 +1,1534 @@ +/** + * 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.v3_2017_03.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 org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 JobExecutions. + */ +public class JobExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobExecutions listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/executions") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v3_2017_03.JobExecutions cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v3_2017_03.JobExecutions create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v3_2017_03.JobExecutions beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v3_2017_03.JobExecutions listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v3_2017_03.JobExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v3_2017_03.JobExecutions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v3_2017_03.JobExecutions beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.v3_2017_03.JobExecutions listByAgentNext" }) + @GET + Observable> listByAgentNext(@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.v3_2017_03.JobExecutions listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancel(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.cancel(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().last().body(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.create(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner beginCreate(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.beginCreate(resourceGroupName, serverName, jobAgentName, jobName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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 a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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 job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @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 jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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, jobAgentName, jobName, jobExecutionId, 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 updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().last().body(); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.beginCreateOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, 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 = 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); + } + + /** + * Lists all executions in a job agent. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @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<JobExecutionInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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 a job's executions. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @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> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @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<JobExecutionInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(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.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobImpl.java new file mode 100644 index 0000000000000..788bdf03e74cb --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobImpl.java @@ -0,0 +1,125 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.Job; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.JobSchedule; + +class JobImpl extends CreatableUpdatableImpl implements Job, Job.Definition, Job.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + + JobImpl(String name, SqlManager manager) { + super(name, new JobInner()); + this.manager = manager; + // Set resource name + this.jobName = name; + // + } + + JobImpl(JobInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.jobName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobsInner client = this.manager().inner().jobs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobsInner client = this.manager().inner().jobs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobsInner client = this.manager().inner().jobs(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public JobSchedule schedule() { + return this.inner().schedule(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Integer version() { + return this.inner().version(); + } + + @Override + public JobImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + @Override + public JobImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public JobImpl withSchedule(JobSchedule schedule) { + this.inner().withSchedule(schedule); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobInner.java new file mode 100644 index 0000000000000..90a47e677e748 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobInner.java @@ -0,0 +1,88 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobSchedule; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A job. + */ +@JsonFlatten +public class JobInner extends ProxyResource { + /** + * User-defined description of the job. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The job version number. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /** + * Schedule properties of the job. + */ + @JsonProperty(value = "properties.schedule") + private JobSchedule schedule; + + /** + * Get user-defined description of the job. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set user-defined description of the job. + * + * @param description the description value to set + * @return the JobInner object itself. + */ + public JobInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the job version number. + * + * @return the version value + */ + public Integer version() { + return this.version; + } + + /** + * Get schedule properties of the job. + * + * @return the schedule value + */ + public JobSchedule schedule() { + return this.schedule; + } + + /** + * Set schedule properties of the job. + * + * @param schedule the schedule value to set + * @return the JobInner object itself. + */ + public JobInner withSchedule(JobSchedule schedule) { + this.schedule = schedule; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsImpl.java new file mode 100644 index 0000000000000..386201d03f879 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobStepExecutions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.ExecutionJobJobAgentServerJobExecution; +import com.microsoft.azure.Page; + +class JobStepExecutionsImpl extends WrapperImpl implements JobStepExecutions { + private final SqlManager manager; + + JobStepExecutionsImpl(SqlManager manager) { + super(manager.inner().jobStepExecutions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ExecutionJobJobAgentServerJobExecutionImpl wrapExecutionJobJobAgentServerJobExecutionModel(JobExecutionInner inner) { + return new ExecutionJobJobAgentServerJobExecutionImpl(inner, manager()); + } + + private Observable getJobExecutionInnerUsingJobStepExecutionsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + String jobAgentName = IdParsingUtils.getValueFromIdByName(id, "jobAgents"); + String jobName = IdParsingUtils.getValueFromIdByName(id, "jobs"); + String jobExecutionId = IdParsingUtils.getValueFromIdByName(id, "executions"); + String stepName = IdParsingUtils.getValueFromIdByName(id, "steps"); + JobStepExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + JobStepExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .map(new Func1() { + @Override + public ExecutionJobJobAgentServerJobExecution call(JobExecutionInner inner) { + return wrapExecutionJobJobAgentServerJobExecutionModel(inner); + } + }); + } + + @Override + public Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + JobStepExecutionsInner client = this.inner(); + return client.listByJobExecutionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ExecutionJobJobAgentServerJobExecution call(JobExecutionInner inner) { + return wrapExecutionJobJobAgentServerJobExecutionModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsInner.java new file mode 100644 index 0000000000000..f07ee2e6a7c76 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepExecutionsInner.java @@ -0,0 +1,630 @@ +/** + * 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.v3_2017_03.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 org.joda.time.DateTime; +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 JobStepExecutions. + */ +public class JobStepExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobStepExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobStepExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobStepExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobStepExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobStepExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobStepExecutions listByJobExecution" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps") + Observable> listByJobExecution(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v3_2017_03.JobStepExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @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.v3_2017_03.JobStepExecutions listByJobExecutionNext" }) + @GET + Observable> listByJobExecutionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionDelegate(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 step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).toBlocking().single().body(); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @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 jobAgentName, String jobName, UUID jobExecutionId, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName), serviceCallback); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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, jobAgentName, jobName, jobExecutionId, stepName, 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); + } + + /** + * Lists the step executions of a job execution. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecutionNext(final String nextPageLink) { + ServiceResponse> response = listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @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> listByJobExecutionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable> listByJobExecutionNextAsync(final String nextPageLink) { + return listByJobExecutionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByJobExecutionNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionNextSinglePageAsync(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.listByJobExecutionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepImpl.java new file mode 100644 index 0000000000000..94acaac58ba8e --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobStep; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.JobStepAction; +import com.microsoft.azure.management.sql.v3_2017_03.JobStepOutput; +import com.microsoft.azure.management.sql.v3_2017_03.JobStepExecutionOptions; + +class JobStepImpl extends CreatableUpdatableImpl implements JobStep, JobStep.Definition, JobStep.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private String stepName; + + JobStepImpl(String name, SqlManager manager) { + super(name, new JobStepInner()); + this.manager = manager; + // Set resource name + this.stepName = name; + // + } + + JobStepImpl(JobStepInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.stepName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.stepName = IdParsingUtils.getValueFromIdByName(inner.id(), "steps"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobStepsInner client = this.manager().inner().jobSteps(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobStepsInner client = this.manager().inner().jobSteps(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobStepsInner client = this.manager().inner().jobSteps(); + return client.getByVersionAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public JobStepAction action() { + return this.inner().action(); + } + + @Override + public String credential() { + return this.inner().credential(); + } + + @Override + public JobStepExecutionOptions executionOptions() { + return this.inner().executionOptions(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public JobStepOutput output() { + return this.inner().output(); + } + + @Override + public Integer stepId() { + return this.inner().stepId(); + } + + @Override + public String targetGroup() { + return this.inner().targetGroup(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobStepImpl withExistingVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + this.jobName = jobName; + return this; + } + + @Override + public JobStepImpl withAction(JobStepAction action) { + this.inner().withAction(action); + return this; + } + + @Override + public JobStepImpl withCredential(String credential) { + this.inner().withCredential(credential); + return this; + } + + @Override + public JobStepImpl withTargetGroup(String targetGroup) { + this.inner().withTargetGroup(targetGroup); + return this; + } + + @Override + public JobStepImpl withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.inner().withExecutionOptions(executionOptions); + return this; + } + + @Override + public JobStepImpl withOutput(JobStepOutput output) { + this.inner().withOutput(output); + return this; + } + + @Override + public JobStepImpl withStepId(Integer stepId) { + this.inner().withStepId(stepId); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepInner.java new file mode 100644 index 0000000000000..6854502c31aa3 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepInner.java @@ -0,0 +1,183 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobStepAction; +import com.microsoft.azure.management.sql.v3_2017_03.JobStepOutput; +import com.microsoft.azure.management.sql.v3_2017_03.JobStepExecutionOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A job step. + */ +@JsonFlatten +public class JobStepInner extends ProxyResource { + /** + * The job step's index within the job. If not specified when creating the + * job step, it will be created as the last step. If not specified when + * updating the job step, the step id is not modified. + */ + @JsonProperty(value = "properties.stepId") + private Integer stepId; + + /** + * The resource ID of the target group that the job step will be executed + * on. + */ + @JsonProperty(value = "properties.targetGroup", required = true) + private String targetGroup; + + /** + * The resource ID of the job credential that will be used to connect to + * the targets. + */ + @JsonProperty(value = "properties.credential", required = true) + private String credential; + + /** + * The action payload of the job step. + */ + @JsonProperty(value = "properties.action", required = true) + private JobStepAction action; + + /** + * Output destination properties of the job step. + */ + @JsonProperty(value = "properties.output") + private JobStepOutput output; + + /** + * Execution options for the job step. + */ + @JsonProperty(value = "properties.executionOptions") + private JobStepExecutionOptions executionOptions; + + /** + * Get the job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. + * + * @return the stepId value + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Set the job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. + * + * @param stepId the stepId value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withStepId(Integer stepId) { + this.stepId = stepId; + return this; + } + + /** + * Get the resource ID of the target group that the job step will be executed on. + * + * @return the targetGroup value + */ + public String targetGroup() { + return this.targetGroup; + } + + /** + * Set the resource ID of the target group that the job step will be executed on. + * + * @param targetGroup the targetGroup value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withTargetGroup(String targetGroup) { + this.targetGroup = targetGroup; + return this; + } + + /** + * Get the resource ID of the job credential that will be used to connect to the targets. + * + * @return the credential value + */ + public String credential() { + return this.credential; + } + + /** + * Set the resource ID of the job credential that will be used to connect to the targets. + * + * @param credential the credential value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withCredential(String credential) { + this.credential = credential; + return this; + } + + /** + * Get the action payload of the job step. + * + * @return the action value + */ + public JobStepAction action() { + return this.action; + } + + /** + * Set the action payload of the job step. + * + * @param action the action value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withAction(JobStepAction action) { + this.action = action; + return this; + } + + /** + * Get output destination properties of the job step. + * + * @return the output value + */ + public JobStepOutput output() { + return this.output; + } + + /** + * Set output destination properties of the job step. + * + * @param output the output value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withOutput(JobStepOutput output) { + this.output = output; + return this; + } + + /** + * Get execution options for the job step. + * + * @return the executionOptions value + */ + public JobStepExecutionOptions executionOptions() { + return this.executionOptions; + } + + /** + * Set execution options for the job step. + * + * @param executionOptions the executionOptions value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.executionOptions = executionOptions; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsImpl.java new file mode 100644 index 0000000000000..31e430461288c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobSteps; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v3_2017_03.JobStep; + +class JobStepsImpl extends WrapperImpl implements JobSteps { + private final SqlManager manager; + + JobStepsImpl(SqlManager manager) { + super(manager.inner().jobSteps()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobStepImpl define(String name) { + return wrapModel(name); + } + + private JobStepImpl wrapModel(JobStepInner inner) { + return new JobStepImpl(inner, manager()); + } + + private JobStepImpl wrapModel(String name) { + return new JobStepImpl(name, this.manager()); + } + + @Override + public Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + JobStepsInner client = this.inner(); + return client.listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return new JobStepImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + JobStepsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return new JobStepImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + JobStepsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toCompletable(); + } + + @Override + public Observable listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + JobStepsInner client = this.inner(); + return client.listByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + JobStepsInner client = this.inner(); + return client.getByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName) + .map(new Func1() { + @Override + public JobStep call(JobStepInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsInner.java new file mode 100644 index 0000000000000..e8242e0b3a3cd --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobStepsInner.java @@ -0,0 +1,1044 @@ +/** + * 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.v3_2017_03.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 JobSteps. + */ +public class JobStepsInner { + /** The Retrofit service to perform REST calls. */ + private JobStepsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobStepsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobStepsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobSteps to be + * used by Retrofit to perform actually REST calls. + */ + interface JobStepsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobSteps listByVersion" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps") + Observable> listByVersion(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @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.v3_2017_03.JobSteps getByVersion" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName}") + Observable> getByVersion(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @Path("stepName") String stepName, @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.v3_2017_03.JobSteps listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v3_2017_03.JobSteps get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @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.v3_2017_03.JobSteps createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @Path("subscriptionId") String subscriptionId, @Body JobStepInner 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.v3_2017_03.JobSteps delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @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.v3_2017_03.JobSteps listByVersionNext" }) + @GET + Observable> listByVersionNext(@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.v3_2017_03.JobSteps listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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<JobStepInner> object if successful. + */ + public PagedList listByVersion(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + ServiceResponse> response = listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + return listByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByVersionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + return listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .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(listByVersionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVersionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, 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 = listByVersionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVersionDelegate(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 specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner getByVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).toBlocking().single().body(); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName), serviceCallback); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> getByVersionWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.getByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, 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 = getByVersionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByVersionDelegate(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 all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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<JobStepInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByJob(resourceGroupName, serverName, jobAgentName, jobName, 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 = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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 job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toBlocking().single().body(); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 jobAgentName, String jobName, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName), serviceCallback); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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, jobAgentName, jobName, stepName, 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 job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 jobAgentName, String jobName, String stepName, JobStepInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters), serviceCallback); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, stepName, 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 a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 jobAgentName, String jobName, String stepName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toBlocking().single().body(); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 jobAgentName, String jobName, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName), serviceCallback); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.delete(resourceGroupName, serverName, jobAgentName, jobName, stepName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all job steps in the specified job version. + * + * @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<JobStepInner> object if successful. + */ + public PagedList listByVersionNext(final String nextPageLink) { + ServiceResponse> response = listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps in the specified job version. + * + * @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> listByVersionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVersionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps in the specified job version. + * + * @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<JobStepInner> object + */ + public Observable> listByVersionNextAsync(final String nextPageLink) { + return listByVersionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + * @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<JobStepInner> object + */ + public Observable>> listByVersionNextWithServiceResponseAsync(final String nextPageLink) { + return listByVersionNextSinglePageAsync(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(listByVersionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVersionNextSinglePageAsync(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.listByVersionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByVersionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVersionNextDelegate(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 job steps for a job's current version. + * + * @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<JobStepInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps for a job's current version. + * + * @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> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps for a job's current version. + * + * @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<JobStepInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + * @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<JobStepInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(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.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsImpl.java new file mode 100644 index 0000000000000..a995b7071aeef --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobTargetExecutions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.ExecutionJobJobAgentServerJobExecutionModel; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgentServerJobExecution; +import java.util.UUID; + +class JobTargetExecutionsImpl extends WrapperImpl implements JobTargetExecutions { + private final SqlManager manager; + + JobTargetExecutionsImpl(SqlManager manager) { + super(manager.inner().jobTargetExecutions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ExecutionJobJobAgentServerJobExecutionModelImpl wrapExecutionJobJobAgentServerJobExecutionModelModel(JobExecutionInner inner) { + return new ExecutionJobJobAgentServerJobExecutionModelImpl(inner, manager()); + } + + @Override + public Observable listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + JobTargetExecutionsInner client = this.inner(); + return client.listByJobExecutionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ExecutionJobJobAgentServerJobExecutionModel call(JobExecutionInner inner) { + return wrapExecutionJobJobAgentServerJobExecutionModelModel(inner); + } + }); + } + + @Override + public Observable listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + JobTargetExecutionsInner client = this.inner(); + return client.listByStepAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + JobTargetExecutionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId) + .map(new Func1() { + @Override + public JobAgentServerJobExecution call(JobExecutionInner inner) { + return new JobAgentServerJobExecutionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsInner.java new file mode 100644 index 0000000000000..38f4a1de44a8d --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetExecutionsInner.java @@ -0,0 +1,1101 @@ +/** + * 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.v3_2017_03.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 org.joda.time.DateTime; +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 JobTargetExecutions. + */ +public class JobTargetExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobTargetExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobTargetExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobTargetExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobTargetExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobTargetExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobTargetExecutions listByJobExecution" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/targets") + Observable> listByJobExecution(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v3_2017_03.JobTargetExecutions listByStep" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets") + Observable> listByStep(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.v3_2017_03.JobTargetExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets/{targetId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @Path("targetId") UUID targetId, @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.v3_2017_03.JobTargetExecutions listByJobExecutionNext" }) + @GET + Observable> listByJobExecutionNext(@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.v3_2017_03.JobTargetExecutions listByStepNext" }) + @GET + Observable> listByStepNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId 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.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionDelegate(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 target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByStep(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + ServiceResponse> response = listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @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> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByStepWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + return listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .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(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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 DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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<JobExecutionInner> object if successful. + */ + public PagedList listByStep(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from 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> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByStepWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .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(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param stepName The name of the step. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName 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.listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByStepDelegate(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 target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId).toBlocking().single().body(); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @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 jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId), serviceCallback); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (targetId == null) { + throw new IllegalArgumentException("Parameter targetId 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, jobAgentName, jobName, jobExecutionId, stepName, targetId, 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); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecutionNext(final String nextPageLink) { + ServiceResponse> response = listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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> listByJobExecutionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable> listByJobExecutionNextAsync(final String nextPageLink) { + return listByJobExecutionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByJobExecutionNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(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(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionNextSinglePageAsync(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.listByJobExecutionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionNextDelegate(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 target executions of a job step execution. + * + * @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<JobExecutionInner> object if successful. + */ + public PagedList listByStepNext(final String nextPageLink) { + ServiceResponse> response = listByStepNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @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> listByStepNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @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<JobExecutionInner> object + */ + public Observable> listByStepNextAsync(final String nextPageLink) { + return listByStepNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @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<JobExecutionInner> object + */ + public Observable>> listByStepNextWithServiceResponseAsync(final String nextPageLink) { + return listByStepNextSinglePageAsync(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(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepNextSinglePageAsync(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.listByStepNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByStepNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupImpl.java new file mode 100644 index 0000000000000..6aaf7c07a29b4 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupImpl.java @@ -0,0 +1,116 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobTargetGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_03.JobTarget; + +class JobTargetGroupImpl extends CreatableUpdatableImpl implements JobTargetGroup, JobTargetGroup.Definition, JobTargetGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String targetGroupName; + private List cmembers; + private List umembers; + + JobTargetGroupImpl(String name, SqlManager manager) { + super(name, new JobTargetGroupInner()); + this.manager = manager; + // Set resource name + this.targetGroupName = name; + // + } + + JobTargetGroupImpl(JobTargetGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.targetGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.targetGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "targetGroups"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + JobTargetGroupsInner client = this.manager().inner().jobTargetGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.targetGroupName, this.cmembers) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + JobTargetGroupsInner client = this.manager().inner().jobTargetGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.targetGroupName, this.umembers) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + JobTargetGroupsInner client = this.manager().inner().jobTargetGroups(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.targetGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List members() { + return this.inner().members(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public JobTargetGroupImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + @Override + public JobTargetGroupImpl withMembers(List members) { + if (isInCreateMode()) { + this.cmembers = members; + } else { + this.umembers = members; + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupInner.java new file mode 100644 index 0000000000000..a621ce9594c3b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupInner.java @@ -0,0 +1,48 @@ +/** + * 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.v3_2017_03.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_03.JobTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A group of job targets. + */ +@JsonFlatten +public class JobTargetGroupInner extends ProxyResource { + /** + * Members of the target group. + */ + @JsonProperty(value = "properties.members", required = true) + private List members; + + /** + * Get members of the target group. + * + * @return the members value + */ + public List members() { + return this.members; + } + + /** + * Set members of the target group. + * + * @param members the members value to set + * @return the JobTargetGroupInner object itself. + */ + public JobTargetGroupInner withMembers(List members) { + this.members = members; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsImpl.java new file mode 100644 index 0000000000000..02b1ddbf92030 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobTargetGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.JobTargetGroup; + +class JobTargetGroupsImpl extends WrapperImpl implements JobTargetGroups { + private final SqlManager manager; + + JobTargetGroupsImpl(SqlManager manager) { + super(manager.inner().jobTargetGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobTargetGroupImpl define(String name) { + return wrapModel(name); + } + + private JobTargetGroupImpl wrapModel(JobTargetGroupInner inner) { + return new JobTargetGroupImpl(inner, manager()); + } + + private JobTargetGroupImpl wrapModel(String name) { + return new JobTargetGroupImpl(name, this.manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobTargetGroupsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobTargetGroup call(JobTargetGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + JobTargetGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, targetGroupName) + .map(new Func1() { + @Override + public JobTargetGroup call(JobTargetGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + JobTargetGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsInner.java new file mode 100644 index 0000000000000..ce1cab60a4163 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobTargetGroupsInner.java @@ -0,0 +1,640 @@ +/** + * 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.v3_2017_03.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.v3_2017_03.JobTarget; +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 JobTargetGroups. + */ +public class JobTargetGroupsInner { + /** The Retrofit service to perform REST calls. */ + private JobTargetGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobTargetGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobTargetGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobTargetGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface JobTargetGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobTargetGroups listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v3_2017_03.JobTargetGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @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.v3_2017_03.JobTargetGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobTargetGroupInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobTargetGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @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.v3_2017_03.JobTargetGroups listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobTargetGroupInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all target groups in an agent. + * + 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobTargetGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, 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 = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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 target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 JobTargetGroupInner object if successful. + */ + public JobTargetGroupInner get(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toBlocking().single().body(); + } + + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 jobAgentName, String targetGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName), serviceCallback); + } + + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1, JobTargetGroupInner>() { + @Override + public JobTargetGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName 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, jobAgentName, targetGroupName, 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 target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @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 JobTargetGroupInner object if successful. + */ + public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).toBlocking().single().body(); + } + + /** + * Creates or updates a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @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 jobAgentName, String targetGroupName, List members, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members), serviceCallback); + } + + /** + * Creates or updates a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).map(new Func1, JobTargetGroupInner>() { + @Override + public JobTargetGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName 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 (members == null) { + throw new IllegalArgumentException("Parameter members is required and cannot be null."); + } + Validator.validate(members); + JobTargetGroupInner parameters = new JobTargetGroupInner(); + parameters.withMembers(members); + return service.createOrUpdate(resourceGroupName, serverName, jobAgentName, targetGroupName, 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 = 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 a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 jobAgentName, String targetGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toBlocking().single().body(); + } + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @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 jobAgentName, String targetGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName), serviceCallback); + } + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a target 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 serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName 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.delete(resourceGroupName, serverName, jobAgentName, targetGroupName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all target groups in an agent. + * + * @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<JobTargetGroupInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all target groups in an agent. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all target groups in an agent. + * + * @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<JobTargetGroupInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all target groups in an agent. + * + * @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<JobTargetGroupInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all target groups in an agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobTargetGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionImpl.java new file mode 100644 index 0000000000000..9003d782bb872 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.JobVersion; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class JobVersionImpl extends IndexableRefreshableWrapperImpl implements JobVersion { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String jobAgentName; + private String jobName; + private int jobVersion; + + JobVersionImpl(JobVersionInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.jobAgentName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobAgents"); + this.jobName = IdParsingUtils.getValueFromIdByName(inner.id(), "jobs"); + this.jobVersion = IdParsingUtils.getValueFromIdByName(inner.id(), "versions"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + JobVersionsInner client = this.manager().inner().jobVersions(); + return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.jobVersion); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionInner.java new file mode 100644 index 0000000000000..d2612726bf623 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionInner.java @@ -0,0 +1,17 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.ProxyResource; + +/** + * A job version. + */ +public class JobVersionInner extends ProxyResource { +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsImpl.java new file mode 100644 index 0000000000000..c14e8e331eb48 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.JobVersions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.JobVersion; + +class JobVersionsImpl extends WrapperImpl implements JobVersions { + private final SqlManager manager; + + JobVersionsImpl(SqlManager manager) { + super(manager.inner().jobVersions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private JobVersionImpl wrapModel(JobVersionInner inner) { + return new JobVersionImpl(inner, manager()); + } + + @Override + public Observable listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + JobVersionsInner client = this.inner(); + return client.listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public JobVersion call(JobVersionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + JobVersionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .map(new Func1() { + @Override + public JobVersion call(JobVersionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsInner.java new file mode 100644 index 0000000000000..c7a031368ebd6 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobVersionsInner.java @@ -0,0 +1,428 @@ +/** + * 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.v3_2017_03.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 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 JobVersions. + */ +public class JobVersionsInner { + /** The Retrofit service to perform REST calls. */ + private JobVersionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobVersionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobVersionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobVersionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobVersions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobVersionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.JobVersions listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v3_2017_03.JobVersions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @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.v3_2017_03.JobVersions listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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<JobVersionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all versions of a job. + * + 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 jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobVersionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.listByJob(resourceGroupName, serverName, jobAgentName, jobName, 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 = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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 job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 JobVersionInner object if successful. + */ + public JobVersionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).toBlocking().single().body(); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 jobAgentName, String jobName, int jobVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), serviceCallback); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobVersionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).map(new Func1, JobVersionInner>() { + @Override + public JobVersionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobVersionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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, jobAgentName, jobName, jobVersion, 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 all versions of a job. + * + * @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<JobVersionInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all versions of a job. + * + * @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> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all versions of a job. + * + * @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<JobVersionInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all versions of a job. + * + * @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<JobVersionInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(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(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all versions of a job. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobVersionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(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.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsImpl.java new file mode 100644 index 0000000000000..6feb97b1d4e4f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.Jobs; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.Job; + +class JobsImpl extends WrapperImpl implements Jobs { + private final SqlManager manager; + + JobsImpl(SqlManager manager) { + super(manager.inner().jobs()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public JobImpl define(String name) { + return wrapModel(name); + } + + private JobImpl wrapModel(JobInner inner) { + return new JobImpl(inner, manager()); + } + + private JobImpl wrapModel(String name) { + return new JobImpl(name, this.manager()); + } + + @Override + public Observable listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + JobsInner client = this.inner(); + return client.listByAgentAsync(resourceGroupName, serverName, jobAgentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Job call(JobInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1() { + @Override + public Job call(JobInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, jobAgentName, jobName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsInner.java new file mode 100644 index 0000000000000..72b9a2b2703a3 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/JobsInner.java @@ -0,0 +1,637 @@ +/** + * 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.v3_2017_03.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 Jobs. + */ +public class JobsInner { + /** The Retrofit service to perform REST calls. */ + private JobsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Jobs to be + * used by Retrofit to perform actually REST calls. + */ + interface JobsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.Jobs listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.v3_2017_03.Jobs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v3_2017_03.Jobs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("subscriptionId") String subscriptionId, @Body JobInner 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.v3_2017_03.Jobs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.v3_2017_03.Jobs listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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<JobInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs. + * + 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 jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName 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.listByAgent(resourceGroupName, serverName, jobAgentName, 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 = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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 job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobInner object if successful. + */ + public JobInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobInner>() { + @Override + public JobInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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, jobAgentName, jobName, 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 job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job 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 JobInner object if successful. + */ + public JobInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job 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 serverName, String jobAgentName, String jobName, JobInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters), serviceCallback); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).map(new Func1, JobInner>() { + @Override + public JobInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, 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 a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 jobAgentName, String jobName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The 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 jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + 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 (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName 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.delete(resourceGroupName, serverName, jobAgentName, jobName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of jobs. + * + * @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<JobInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs. + * + * @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> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs. + * + * @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<JobInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs. + * + * @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<JobInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(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(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(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.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupImpl.java new file mode 100644 index 0000000000000..202d49fc8ad7f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupImpl.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.LongTermRetentionBackup; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class LongTermRetentionBackupImpl extends IndexableRefreshableWrapperImpl implements LongTermRetentionBackup { + private final SqlManager manager; + private String locationName; + private String longTermRetentionServerName; + private String longTermRetentionDatabaseName; + private String backupName; + + LongTermRetentionBackupImpl(LongTermRetentionBackupInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.longTermRetentionServerName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionServers"); + this.longTermRetentionDatabaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionDatabases"); + this.backupName = IdParsingUtils.getValueFromIdByName(inner.id(), "longTermRetentionBackups"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + LongTermRetentionBackupsInner client = this.manager().inner().longTermRetentionBackups(); + return client.getAsync(this.locationName, this.longTermRetentionServerName, this.longTermRetentionDatabaseName, 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 String name() { + return this.inner().name(); + } + + @Override + public DateTime serverCreateTime() { + return this.inner().serverCreateTime(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupInner.java new file mode 100644 index 0000000000000..65e7c0432d33c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupInner.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.v3_2017_03.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. + */ +@JsonFlatten +public class LongTermRetentionBackupInner extends ProxyResource { + /** + * The server name that the backup database belong to. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The create time of the server. + */ + @JsonProperty(value = "properties.serverCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime serverCreateTime; + + /** + * 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 server name that the backup database belong to. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the create time of the server. + * + * @return the serverCreateTime value + */ + public DateTime serverCreateTime() { + return this.serverCreateTime; + } + + /** + * 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsImpl.java new file mode 100644 index 0000000000000..22ec7a528d193 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsImpl.java @@ -0,0 +1,108 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.LongTermRetentionBackups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.LongTermRetentionBackup; + +class LongTermRetentionBackupsImpl extends WrapperImpl implements LongTermRetentionBackups { + private final SqlManager manager; + + LongTermRetentionBackupsImpl(SqlManager manager) { + super(manager.inner().longTermRetentionBackups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private LongTermRetentionBackupImpl wrapModel(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + + @Override + public Observable listByLocationAsync(final String locationName) { + LongTermRetentionBackupsInner 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 LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(final String locationName, final String longTermRetentionServerName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.listByServerAsync(locationName, longTermRetentionServerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.listByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.getAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsInner.java new file mode 100644 index 0000000000000..602f0ebef7c77 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/LongTermRetentionBackupsInner.java @@ -0,0 +1,1468 @@ +/** + * 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.v3_2017_03.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.v3_2017_03.LongTermRetentionDatabaseState; +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 LongTermRetentionBackups. + */ +public class LongTermRetentionBackupsInner { + /** The Retrofit service to perform REST calls. */ + private LongTermRetentionBackupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionBackupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LongTermRetentionBackupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(LongTermRetentionBackupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LongTermRetentionBackups to be + * used by Retrofit to perform actually REST calls. + */ + interface LongTermRetentionBackupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.LongTermRetentionBackups get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + Observable> get(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @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.v3_2017_03.LongTermRetentionBackups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @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.v3_2017_03.LongTermRetentionBackups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @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.v3_2017_03.LongTermRetentionBackups listByDatabase" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups") + Observable> listByDatabase(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState 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.v3_2017_03.LongTermRetentionBackups listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups") + Observable> listByLocation(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState 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.v3_2017_03.LongTermRetentionBackups listByServer" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups") + Observable> listByServer(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState 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.v3_2017_03.LongTermRetentionBackups 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.v3_2017_03.LongTermRetentionBackups 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.v3_2017_03.LongTermRetentionBackups listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 LongTermRetentionBackupInner object if successful. + */ + public LongTermRetentionBackupInner get(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionBackupInner object + */ + public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, LongTermRetentionBackupInner>() { + @Override + public LongTermRetentionBackupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionBackupInner object + */ + public Observable> getWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().last().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName 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 + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName 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> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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 LongTermRetentionDatabaseState databaseState = null; + return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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 longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, 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 database. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName the String value + ServiceResponse> * @param longTermRetentionDatabaseName the String value + 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<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName 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, longTermRetentionServerName, longTermRetentionDatabaseName, 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 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<LongTermRetentionBackupInner> 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 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 a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> 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 a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> 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 a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> 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 LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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 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 LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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 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<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState 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); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName 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 + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName 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> listByServerAsync(final String locationName, final String longTermRetentionServerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName) + .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)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName 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 LongTermRetentionDatabaseState databaseState = null; + return service.listByServer(locationName, longTermRetentionServerName, 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 = listByServerDelegate(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 server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @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<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName, 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(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName the String value + 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<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName 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(locationName, longTermRetentionServerName, 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 = 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); + } + + /** + * Lists all long term retention backups for a 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<LongTermRetentionBackupInner> 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 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 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<LongTermRetentionBackupInner> 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 the long term retention backups for a given 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<LongTermRetentionBackupInner> 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(); + } + }; + } + + /** + * Lists the long term retention backups for a given 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); + } + + /** + * Lists the long term retention backups for a given 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<LongTermRetentionBackupInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given 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<LongTermRetentionBackupInner> 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)); + } + }); + } + + /** + * Lists the long term retention backups for a given 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<LongTermRetentionBackupInner> 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..87781c141566f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicy; + +class ManagedBackupShortTermRetentionPoliciesImpl extends WrapperImpl implements ManagedBackupShortTermRetentionPolicies { + private final SqlManager manager; + + ManagedBackupShortTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().managedBackupShortTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedBackupShortTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private ManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, manager()); + } + + private ManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new ManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedBackupShortTermRetentionPoliciesInner 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 ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedBackupShortTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..89845b3bee362 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPoliciesInner.java @@ -0,0 +1,1135 @@ +/** + * 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.v3_2017_03.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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 ManagedBackupShortTermRetentionPolicies. + */ +public class ManagedBackupShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedBackupShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedBackupShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedBackupShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedBackupShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedBackupShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedBackupShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{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.v3_2017_03.ManagedBackupShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@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, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies") + 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.v3_2017_03.ManagedBackupShortTermRetentionPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed database's short 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 short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner 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); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 + */ + public Observable> createOrUpdateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 = 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); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 + */ + public Observable> updateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, managedInstanceName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed database's short 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 retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { + 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, managedInstanceName, databaseName, policyName, 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @param resourceGroupName The 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + 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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @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 managed database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> 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 managed database's short term retention policy list. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedBackupShortTermRetentionPolicyInner> 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..30f5d9fc8f1a2 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ManagedBackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements ManagedBackupShortTermRetentionPolicy, ManagedBackupShortTermRetentionPolicy.Definition, ManagedBackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + ManagedBackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedBackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ManagedBackupShortTermRetentionPolicyImpl(ManagedBackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + 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 name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedBackupShortTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..b53e4b1d5e4e2 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedBackupShortTermRetentionPolicyInner.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.v3_2017_03.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A short term retention policy. + */ +@JsonFlatten +public class ManagedBackupShortTermRetentionPolicyInner extends ProxyResource { + /** + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @param retentionDays the retentionDays value to set + * @return the ManagedBackupShortTermRetentionPolicyInner object itself. + */ + public ManagedBackupShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseImpl.java new file mode 100644 index 0000000000000..f555efb8292d3 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseImpl.java @@ -0,0 +1,277 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabase; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabaseUpdate; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabaseStatus; +import com.microsoft.azure.management.sql.v3_2017_03.CatalogCollationType; +import com.microsoft.azure.management.sql.v3_2017_03.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(); + // resource ancestor names + 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 name() { + return this.inner().name(); + } + + @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 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseInner.java new file mode 100644 index 0000000000000..7b47487ab12f1 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabaseInner.java @@ -0,0 +1,296 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabaseStatus; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_03.CatalogCollationType; +import com.microsoft.azure.management.sql.v3_2017_03.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 for the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible'. + */ + @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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + */ + @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; + + /** + * 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; + + /** + * 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 for the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * + * @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 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; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesImpl.java new file mode 100644 index 0000000000000..469eb89444cbf --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabases; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabase; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; + +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) + .map(new Func1() { + @Override + public ManagedDatabase call(ManagedDatabaseInner inner) { + return 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 locationName, UUID operationId, String lastBackupName) { + ManagedDatabasesInner client = this.inner(); + return client.completeRestoreAsync(locationName, operationId, lastBackupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesInner.java new file mode 100644 index 0000000000000..8b13a583398f3 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ManagedDatabasesInner.java @@ -0,0 +1,1156 @@ +/** + * 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.v3_2017_03.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.v3_2017_03.CompleteDatabaseRestoreDefinition; +import com.microsoft.azure.management.sql.v3_2017_03.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 java.util.UUID; +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.v3_2017_03.ManagedDatabases completeRestore" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore") + Observable> completeRestore(@Path("locationName") String locationName, @Path("operationId") UUID operationId, @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.v3_2017_03.ManagedDatabases beginCompleteRestore" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore") + Observable> beginCompleteRestore(@Path("locationName") String locationName, @Path("operationId") UUID operationId, @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.v3_2017_03.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.v3_2017_03.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.v3_2017_03.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.v3_2017_03.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.v3_2017_03.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.v3_2017_03.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.v3_2017_03.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.v3_2017_03.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.v3_2017_03.ManagedDatabases listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().last().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + return completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName 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."); + } + 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(locationName, operationId, 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 locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().single().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + return beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @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 locationName, UUID operationId, String lastBackupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName 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."); + } + if (lastBackupName == null) { + throw new IllegalArgumentException("Parameter lastBackupName is required and cannot be null."); + } + CompleteDatabaseRestoreDefinition parameters = new CompleteDatabaseRestoreDefinition(); + parameters.withLastBackupName(lastBackupName); + return service.beginCompleteRestore(locationName, operationId, 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 resourceGroupName The 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 the 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 the 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 the 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 the 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 the 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 the 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 the 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 the 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); + } + + /** + * 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl.java new file mode 100644 index 0000000000000..f7171cdedb3a1 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2017_03.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl1.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl1.java new file mode 100644 index 0000000000000..0a50674e3b733 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2017_03.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointImpl.java new file mode 100644 index 0000000000000..f01eb1944cb05 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointImpl.java @@ -0,0 +1,86 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.RestorePoint; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_03.RestorePointType; + +class RestorePointImpl extends IndexableRefreshableWrapperImpl implements RestorePoint { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String restorePointName; + + RestorePointImpl(RestorePointInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.restorePointName = IdParsingUtils.getValueFromIdByName(inner.id(), "restorePoints"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RestorePointsInner client = this.manager().inner().restorePoints(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.restorePointName); + } + + + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime restorePointCreationDate() { + return this.inner().restorePointCreationDate(); + } + + @Override + public String restorePointLabel() { + return this.inner().restorePointLabel(); + } + + @Override + public RestorePointType restorePointType() { + return this.inner().restorePointType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointInner.java new file mode 100644 index 0000000000000..9f76dddf6c79a --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointInner.java @@ -0,0 +1,98 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.RestorePointType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Database restore points. + */ +@JsonFlatten +public class RestorePointInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The type of restore point. Possible values include: 'CONTINUOUS', + * 'DISCRETE'. + */ + @JsonProperty(value = "properties.restorePointType", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointType restorePointType; + + /** + * The earliest time to which this database can be restored. + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The time the backup was taken. + */ + @JsonProperty(value = "properties.restorePointCreationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime restorePointCreationDate; + + /** + * The label of restore point for backup request by user. + */ + @JsonProperty(value = "properties.restorePointLabel", access = JsonProperty.Access.WRITE_ONLY) + private String restorePointLabel; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the type of restore point. Possible values include: 'CONTINUOUS', 'DISCRETE'. + * + * @return the restorePointType value + */ + public RestorePointType restorePointType() { + return this.restorePointType; + } + + /** + * Get the earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the time the backup was taken. + * + * @return the restorePointCreationDate value + */ + public DateTime restorePointCreationDate() { + return this.restorePointCreationDate; + } + + /** + * Get the label of restore point for backup request by user. + * + * @return the restorePointLabel value + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsImpl.java new file mode 100644 index 0000000000000..34ce925123c4b --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.RestorePoints; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_03.RestorePoint; + +class RestorePointsImpl extends WrapperImpl implements RestorePoints { + private final SqlManager manager; + + RestorePointsImpl(SqlManager manager) { + super(manager.inner().restorePoints()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RestorePointImpl wrapModel(RestorePointInner inner) { + return new RestorePointImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + RestorePointsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RestorePoint call(RestorePointInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + RestorePointsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, restorePointName) + .map(new Func1() { + @Override + public RestorePoint call(RestorePointInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + RestorePointsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, restorePointName).toCompletable(); + } + + @Override + public Observable createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + RestorePointsInner client = this.inner(); + return client.createAsync(resourceGroupName, serverName, databaseName, restorePointLabel) + .map(new Func1() { + @Override + public RestorePoint call(RestorePointInner inner) { + return new RestorePointImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsInner.java new file mode 100644 index 0000000000000..3c6fb1250b9df --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/RestorePointsInner.java @@ -0,0 +1,567 @@ +/** + * 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.v3_2017_03.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2017_03.CreateDatabaseRestorePointDefinition; +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.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.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RestorePoints. + */ +public class RestorePointsInner { + /** The Retrofit service to perform REST calls. */ + private RestorePointsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorePointsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RestorePointsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RestorePointsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RestorePoints to be + * used by Retrofit to perform actually REST calls. + */ + interface RestorePointsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.RestorePoints listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") + 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.v3_2017_03.RestorePoints create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") + Observable> create(@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, @Body CreateDatabaseRestorePointDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.RestorePoints beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") + Observable> beginCreate(@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, @Body CreateDatabaseRestorePointDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.RestorePoints get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("restorePointName") String restorePointName, @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.v3_2017_03.RestorePoints delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("restorePointName") String restorePointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @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 List<RestorePointInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @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(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RestorePointInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of database restore points. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RestorePointInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(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."); + } + 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); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 + * @return the RestorePointInner object if successful. + */ + public RestorePointInner create(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).toBlocking().last().body(); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel), serviceCallback); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return createWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).map(new Func1, RestorePointInner>() { + @Override + public RestorePointInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + 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."); + } + if (restorePointLabel == null) { + throw new IllegalArgumentException("Parameter restorePointLabel is required and cannot be null."); + } + CreateDatabaseRestorePointDefinition parameters = new CreateDatabaseRestorePointDefinition(); + parameters.withRestorePointLabel(restorePointLabel); + Observable> observable = service.create(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 + * @return the RestorePointInner object if successful. + */ + public RestorePointInner beginCreate(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).toBlocking().single().body(); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label 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 beginCreateAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel), serviceCallback); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).map(new Func1, RestorePointInner>() { + @Override + public RestorePointInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param resourceGroupName The 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. + * @param restorePointLabel The restore point label to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) { + 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."); + } + if (restorePointLabel == null) { + throw new IllegalArgumentException("Parameter restorePointLabel is required and cannot be null."); + } + CreateDatabaseRestorePointDefinition parameters = new CreateDatabaseRestorePointDefinition(); + parameters.withRestorePointLabel(restorePointLabel); + return service.beginCreate(resourceGroupName, serverName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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 RestorePointInner object if successful. + */ + public RestorePointInner get(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).toBlocking().single().body(); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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, String restorePointName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName), serviceCallback); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).map(new Func1, RestorePointInner>() { + @Override + public RestorePointInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorePointInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + 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 (restorePointName == null) { + throw new IllegalArgumentException("Parameter restorePointName 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, databaseName, restorePointName, 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 restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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 databaseName, String restorePointName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).toBlocking().single().body(); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @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 databaseName, String restorePointName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName), serviceCallback); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a restore point. + * + * @param resourceGroupName The 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. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + 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 (restorePointName == null) { + throw new IllegalArgumentException("Parameter restorePointName 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.delete(resourceGroupName, serverName, databaseName, restorePointName, 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); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningImpl.java new file mode 100644 index 0000000000000..369d32c3bac57 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningImpl.java @@ -0,0 +1,59 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ServerAutomaticTuning; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.AutomaticTuningServerMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2017_03.AutomaticTuningServerOptions; + +class ServerAutomaticTuningImpl extends WrapperImpl implements ServerAutomaticTuning { + private final SqlManager manager; + ServerAutomaticTuningImpl(ServerAutomaticTuningInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public AutomaticTuningServerMode actualState() { + return this.inner().actualState(); + } + + @Override + public AutomaticTuningServerMode desiredState() { + return this.inner().desiredState(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map options() { + return this.inner().options(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningInner.java new file mode 100644 index 0000000000000..f53eeb5b8b4f0 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningInner.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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.AutomaticTuningServerMode; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2017_03.AutomaticTuningServerOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Server-level Automatic Tuning. + */ +@JsonFlatten +public class ServerAutomaticTuningInner extends ProxyResource { + /** + * Automatic tuning desired state. Possible values include: 'Custom', + * 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.desiredState") + private AutomaticTuningServerMode desiredState; + + /** + * Automatic tuning actual state. Possible values include: 'Custom', + * 'Auto', 'Unspecified'. + */ + @JsonProperty(value = "properties.actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerMode actualState; + + /** + * Automatic tuning options definition. + */ + @JsonProperty(value = "properties.options") + private Map options; + + /** + * Get automatic tuning desired state. Possible values include: 'Custom', 'Auto', 'Unspecified'. + * + * @return the desiredState value + */ + public AutomaticTuningServerMode desiredState() { + return this.desiredState; + } + + /** + * Set automatic tuning desired state. Possible values include: 'Custom', 'Auto', 'Unspecified'. + * + * @param desiredState the desiredState value to set + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withDesiredState(AutomaticTuningServerMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get automatic tuning actual state. Possible values include: 'Custom', 'Auto', 'Unspecified'. + * + * @return the actualState value + */ + public AutomaticTuningServerMode actualState() { + return this.actualState; + } + + /** + * Get automatic tuning options definition. + * + * @return the options value + */ + public Map options() { + return this.options; + } + + /** + * Set automatic tuning options definition. + * + * @param options the options value to set + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withOptions(Map options) { + this.options = options; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..a45959735ef00 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ServerAutomaticTunings; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.ServerAutomaticTuning; + +class ServerAutomaticTuningsImpl extends WrapperImpl implements ServerAutomaticTunings { + private final SqlManager manager; + + ServerAutomaticTuningsImpl(SqlManager manager) { + super(manager.inner().serverAutomaticTunings()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerAutomaticTuningsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerAutomaticTuning call(ServerAutomaticTuningInner inner) { + return new ServerAutomaticTuningImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + ServerAutomaticTuningsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serverName, parameters) + .map(new Func1() { + @Override + public ServerAutomaticTuning call(ServerAutomaticTuningInner inner) { + return new ServerAutomaticTuningImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsInner.java new file mode 100644 index 0000000000000..c516b82d1b72c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerAutomaticTuningsInner.java @@ -0,0 +1,247 @@ +/** + * 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.v3_2017_03.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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 ServerAutomaticTunings. + */ +public class ServerAutomaticTuningsInner { + /** The Retrofit service to perform REST calls. */ + private ServerAutomaticTuningsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAutomaticTuningsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerAutomaticTuningsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerAutomaticTuningsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerAutomaticTunings to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerAutomaticTuningsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ServerAutomaticTunings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current") + Observable> get(@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.v3_2017_03.ServerAutomaticTunings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerAutomaticTuningInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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 ServerAutomaticTuningInner object if successful. + */ + public ServerAutomaticTuningInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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 ServerAutomaticTuningInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerAutomaticTuningInner>() { + @Override + public ServerAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves server automatic tuning options. + * + * @param resourceGroupName The 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 ServerAutomaticTuningInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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.get(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 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); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning 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 ServerAutomaticTuningInner object if successful. + */ + public ServerAutomaticTuningInner update(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning 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 serverName, ServerAutomaticTuningInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAutomaticTuningInner object + */ + public Observable updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerAutomaticTuningInner>() { + @Override + public ServerAutomaticTuningInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update automatic tuning options on 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 parameters The requested automatic tuning resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerAutomaticTuningInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner 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 (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.update(resourceGroupName, serverName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..09f78929c048d --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ServerBlobAuditingPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.ServerBlobAuditingPolicy; + +class ServerBlobAuditingPoliciesImpl extends WrapperImpl implements ServerBlobAuditingPolicies { + private final SqlManager manager; + + ServerBlobAuditingPoliciesImpl(SqlManager manager) { + super(manager.inner().serverBlobAuditingPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerBlobAuditingPolicyImpl define(String name) { + return wrapModel(name); + } + + private ServerBlobAuditingPolicyImpl wrapModel(ServerBlobAuditingPolicyInner inner) { + return new ServerBlobAuditingPolicyImpl(inner, manager()); + } + + private ServerBlobAuditingPolicyImpl wrapModel(String name) { + return new ServerBlobAuditingPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerBlobAuditingPolicy call(ServerBlobAuditingPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesInner.java new file mode 100644 index 0000000000000..79668b2e5448f --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.v3_2017_03.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerBlobAuditingPolicies. + */ +public class ServerBlobAuditingPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ServerBlobAuditingPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerBlobAuditingPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerBlobAuditingPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerBlobAuditingPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerBlobAuditingPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerBlobAuditingPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ServerBlobAuditingPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @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.v3_2017_03.ServerBlobAuditingPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerBlobAuditingPolicyInner 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.v3_2017_03.ServerBlobAuditingPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a server's blob auditing 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. + * @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 ServerBlobAuditingPolicyInner object if successful. + */ + public ServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets a server's blob auditing 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 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's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerBlobAuditingPolicyInner>() { + @Override + public ServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server's blob auditing 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String blobAuditingPolicyName = "default"; + return service.get(resourceGroupName, serverName, blobAuditingPolicyName, 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 server's blob auditing 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 parameters Properties of blob auditing 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 ServerBlobAuditingPolicyInner object if successful. + */ + public ServerBlobAuditingPolicyInner createOrUpdate(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing 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, ServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerBlobAuditingPolicyInner>() { + @Override + public ServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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 server's blob auditing 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 parameters Properties of blob auditing 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 ServerBlobAuditingPolicyInner object if successful. + */ + public ServerBlobAuditingPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerBlobAuditingPolicyInner>() { + @Override + public ServerBlobAuditingPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a server's blob auditing 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 parameters Properties of blob auditing policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerBlobAuditingPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner 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 (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 blobAuditingPolicyName = "default"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, blobAuditingPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..d538548b7ea45 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyImpl.java @@ -0,0 +1,183 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ServerBlobAuditingPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; + +class ServerBlobAuditingPolicyImpl extends CreatableUpdatableImpl implements ServerBlobAuditingPolicy, ServerBlobAuditingPolicy.Definition, ServerBlobAuditingPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerBlobAuditingPolicyImpl(String name, SqlManager manager) { + super(name, new ServerBlobAuditingPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerBlobAuditingPolicyImpl(ServerBlobAuditingPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerBlobAuditingPoliciesInner client = this.manager().inner().serverBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerBlobAuditingPoliciesInner client = this.manager().inner().serverBlobAuditingPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerBlobAuditingPoliciesInner client = this.manager().inner().serverBlobAuditingPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List auditActionsAndGroups() { + return this.inner().auditActionsAndGroups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAzureMonitorTargetEnabled() { + return this.inner().isAzureMonitorTargetEnabled(); + } + + @Override + public Boolean isStorageSecondaryKeyInUse() { + return this.inner().isStorageSecondaryKeyInUse(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public BlobAuditingPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public UUID storageAccountSubscriptionId() { + return this.inner().storageAccountSubscriptionId(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.inner().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + @Override + public ServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..76bc020828ca3 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerBlobAuditingPolicyInner.java @@ -0,0 +1,428 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.BlobAuditingPolicyState; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server blob auditing policy. + */ +@JsonFlatten +public class ServerBlobAuditingPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private BlobAuditingPolicyState state; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, storageAccountAccessKey is + * required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the Actions-Groups and Actions to audit. + * + * The recommended set of action groups to use is the following combination + * - this will audit all the queries and stored procedures executed against + * the database, as well as successful and failed logins: + * + * BATCH_COMPLETED_GROUP, + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + * FAILED_DATABASE_AUTHENTICATION_GROUP. + * + * This above combination is also the set that is configured by default + * when enabling auditing from the Azure portal. + * + * The supported action groups to audit are (note: choose only specific + * groups that cover your auditing needs. Using unnecessary groups could + * lead to very large quantities of audit records): + * + * APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + * BACKUP_RESTORE_GROUP + * DATABASE_LOGOUT_GROUP + * DATABASE_OBJECT_CHANGE_GROUP + * DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + * DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + * DATABASE_OPERATION_GROUP + * DATABASE_PERMISSION_CHANGE_GROUP + * DATABASE_PRINCIPAL_CHANGE_GROUP + * DATABASE_PRINCIPAL_IMPERSONATION_GROUP + * DATABASE_ROLE_MEMBER_CHANGE_GROUP + * FAILED_DATABASE_AUTHENTICATION_GROUP + * SCHEMA_OBJECT_ACCESS_GROUP + * SCHEMA_OBJECT_CHANGE_GROUP + * SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + * SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + * SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + * USER_CHANGE_PASSWORD_GROUP + * BATCH_STARTED_GROUP + * BATCH_COMPLETED_GROUP + * + * These are groups that cover all sql statements and stored procedures + * executed against the database, and should not be used in combination + * with other groups as this will result in duplicate audit logs. + * + * For more information, see [Database-Level Audit Action + * Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + * + * For Database auditing policy, specific Actions can also be specified + * (note that Actions cannot be specified for Server auditing policy). The + * supported actions to audit are: + * SELECT + * UPDATE + * INSERT + * DELETE + * EXECUTE + * RECEIVE + * REFERENCES + * + * The general form for defining an action to be audited is: + * {action} ON {object} BY {principal} + * + * Note that <object> in the above format can refer to an object like + * a table, view, or stored procedure, or an entire database or schema. For + * the latter cases, the forms DATABASE::{db_name} and + * SCHEMA::{schema_name} are used, respectively. + * + * For example: + * SELECT on dbo.myTable by public + * SELECT on DATABASE::myDatabase by public + * SELECT on SCHEMA::mySchema by public + * + * For more information, see [Database-Level Audit + * Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + */ + @JsonProperty(value = "properties.auditActionsAndGroups") + private List auditActionsAndGroups; + + /** + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "properties.storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "properties.isStorageSecondaryKeyInUse") + private Boolean isStorageSecondaryKeyInUse; + + /** + * Specifies whether audit events are sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'SQLSecurityAuditEvents' diagnostic logs category on the database should + * be also created. + * Note that for server level audit you should use the 'master' database as + * {databaseName}. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + * + * For more information, see [Diagnostic Settings REST + * API](https://go.microsoft.com/fwlink/?linkid=2033207) + * or [Diagnostic Settings + * PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + */ + @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @return the state value + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @return the auditActionsAndGroups value + */ + public List auditActionsAndGroups() { + return this.auditActionsAndGroups; + } + + /** + * Set specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions). + * + * @param auditActionsAndGroups the auditActionsAndGroups value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Get specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @return the isStorageSecondaryKeyInUse value + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set specifies whether storageAccountAccessKey value is the storage's secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @return the isAzureMonitorTargetEnabled value + */ + public Boolean isAzureMonitorTargetEnabled() { + return this.isAzureMonitorTargetEnabled; + } + + /** + * Set specifies whether audit events are sent to Azure Monitor. + In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + Diagnostic Settings URI format: + PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043). + * + * @param isAzureMonitorTargetEnabled the isAzureMonitorTargetEnabled value to set + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasImpl.java new file mode 100644 index 0000000000000..4c0154e51ef60 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasImpl.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. + */ + +package com.microsoft.azure.management.sql.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ServerDnsAlias; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ServerDnsAliasImpl extends CreatableUpdatableImpl implements ServerDnsAlias, ServerDnsAlias.Definition, ServerDnsAlias.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String dnsAliasName; + + ServerDnsAliasImpl(String name, SqlManager manager) { + super(name, new ServerDnsAliasInner()); + this.manager = manager; + // Set resource name + this.dnsAliasName = name; + // + } + + ServerDnsAliasImpl(ServerDnsAliasInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dnsAliasName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.dnsAliasName = IdParsingUtils.getValueFromIdByName(inner.id(), "dnsAliases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServerDnsAliasesInner client = this.manager().inner().serverDnsAliases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.dnsAliasName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerDnsAliasesInner client = this.manager().inner().serverDnsAliases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.dnsAliasName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerDnsAliasesInner client = this.manager().inner().serverDnsAliases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.dnsAliasName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String azureDnsRecord() { + return this.inner().azureDnsRecord(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerDnsAliasImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasInner.java new file mode 100644 index 0000000000000..8d645e1ea8f62 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasInner.java @@ -0,0 +1,35 @@ +/** + * 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.v3_2017_03.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server DNS alias. + */ +@JsonFlatten +public class ServerDnsAliasInner extends ProxyResource { + /** + * The fully qualified DNS record for alias. + */ + @JsonProperty(value = "properties.azureDnsRecord", access = JsonProperty.Access.WRITE_ONLY) + private String azureDnsRecord; + + /** + * Get the fully qualified DNS record for alias. + * + * @return the azureDnsRecord value + */ + public String azureDnsRecord() { + return this.azureDnsRecord; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesImpl.java new file mode 100644 index 0000000000000..e4ba2b2523a88 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesImpl.java @@ -0,0 +1,87 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ServerDnsAliases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_03.ServerDnsAlias; + +class ServerDnsAliasesImpl extends WrapperImpl implements ServerDnsAliases { + private final SqlManager manager; + + ServerDnsAliasesImpl(SqlManager manager) { + super(manager.inner().serverDnsAliases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerDnsAliasImpl define(String name) { + return wrapModel(name); + } + + private ServerDnsAliasImpl wrapModel(ServerDnsAliasInner inner) { + return new ServerDnsAliasImpl(inner, manager()); + } + + private ServerDnsAliasImpl wrapModel(String name) { + return new ServerDnsAliasImpl(name, this.manager()); + } + + @Override + public Completable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasesInner client = this.inner(); + return client.acquireAsync(resourceGroupName, serverName, dnsAliasName).toCompletable(); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerDnsAliasesInner 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 ServerDnsAlias call(ServerDnsAliasInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, dnsAliasName) + .map(new Func1() { + @Override + public ServerDnsAlias call(ServerDnsAliasInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, dnsAliasName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesInner.java new file mode 100644 index 0000000000000..791607bdbb9db --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerDnsAliasesInner.java @@ -0,0 +1,1115 @@ +/** + * 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.v3_2017_03.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.v3_2017_03.ServerDnsAliasAcquisition; +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.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 ServerDnsAliases. + */ +public class ServerDnsAliasesInner { + /** The Retrofit service to perform REST calls. */ + private ServerDnsAliasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerDnsAliasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerDnsAliasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerDnsAliasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerDnsAliases to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerDnsAliasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ServerDnsAliases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v3_2017_03.ServerDnsAliases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v3_2017_03.ServerDnsAliases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v3_2017_03.ServerDnsAliases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v3_2017_03.ServerDnsAliases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @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.v3_2017_03.ServerDnsAliases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases") + 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.v3_2017_03.ServerDnsAliases acquire" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire") + Observable> acquire(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerDnsAliasAcquisition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ServerDnsAliases beginAcquire" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire") + Observable> beginAcquire(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("dnsAliasName") String dnsAliasName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ServerDnsAliasAcquisition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ServerDnsAliases listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 ServerDnsAliasInner object if successful. + */ + public ServerDnsAliasInner get(String resourceGroupName, String serverName, String dnsAliasName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, ServerDnsAliasInner>() { + @Override + public ServerDnsAliasInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a server DNS alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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, dnsAliasName, 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 server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 ServerDnsAliasInner object if successful. + */ + public ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, ServerDnsAliasInner>() { + @Override + public ServerDnsAliasInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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.createOrUpdate(resourceGroupName, serverName, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 ServerDnsAliasInner object if successful. + */ + public ServerDnsAliasInner beginCreateOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, ServerDnsAliasInner>() { + @Override + public ServerDnsAliasInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a server dns alias. + * + * @param resourceGroupName The 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerDnsAliasInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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.beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, 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 = 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 the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @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 dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the server DNS alias with the 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 that the alias is pointing to. + * @param dnsAliasName The name of the server DNS alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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, dnsAliasName, 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 a list of server DNS aliases for 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 that the alias is pointing to. + * @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<ServerDnsAliasInner> 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 DNS aliases for 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 that the alias is pointing to. + * @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 DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerDnsAliasInner> 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 DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerDnsAliasInner> 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 DNS aliases for 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 that the alias is pointing to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerDnsAliasInner> 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); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 acquire(String resourceGroupName, String serverName, String dnsAliasName) { + acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> acquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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 oldServerDnsAliasId = null; + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(null); + Observable> observable = service.acquire(resourceGroupName, serverName, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 acquire(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).toBlocking().last().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable acquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + return acquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> acquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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."); + } + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(oldServerDnsAliasId); + Observable> observable = service.acquire(resourceGroupName, serverName, dnsAliasName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 beginAcquire(String resourceGroupName, String serverName, String dnsAliasName) { + beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @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 beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginAcquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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 oldServerDnsAliasId = null; + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(null); + return service.beginAcquire(resourceGroupName, serverName, dnsAliasName, 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 = beginAcquireDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 beginAcquire(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).toBlocking().single().body(); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @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 beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId), serviceCallback); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + return beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Acquires server DNS alias from another 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 that the alias is pointing to. + * @param dnsAliasName The name of the server dns alias. + * @param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginAcquireWithServiceResponseAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) { + 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 (dnsAliasName == null) { + throw new IllegalArgumentException("Parameter dnsAliasName 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."); + } + ServerDnsAliasAcquisition parameters = new ServerDnsAliasAcquisition(); + parameters.withOldServerDnsAliasId(oldServerDnsAliasId); + return service.beginAcquire(resourceGroupName, serverName, dnsAliasName, 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 = beginAcquireDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginAcquireDelegate(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 server DNS aliases for 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<ServerDnsAliasInner> 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 DNS aliases for 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 a list of server DNS aliases for 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<ServerDnsAliasInner> 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 DNS aliases for 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<ServerDnsAliasInner> 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 DNS aliases for 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<ServerDnsAliasInner> 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/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..31cbe94344690 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesImpl.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.v3_2017_03.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_03.ServerSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_03.ServerSecurityAlertPolicy; + +class ServerSecurityAlertPoliciesImpl extends WrapperImpl implements ServerSecurityAlertPolicies { + private final SqlManager manager; + + ServerSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().serverSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerSecurityAlertPolicyImpl define(String name) { + return wrapModel(name); + } + + private ServerSecurityAlertPolicyImpl wrapModel(ServerSecurityAlertPolicyInner inner) { + return new ServerSecurityAlertPolicyImpl(inner, manager()); + } + + private ServerSecurityAlertPolicyImpl wrapModel(String name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerSecurityAlertPolicy call(ServerSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesInner.java new file mode 100644 index 0000000000000..fb0bd415c8656 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.v3_2017_03.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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServerSecurityAlertPolicies. + */ +public class ServerSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ServerSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_03.ServerSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v3_2017_03.ServerSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerSecurityAlertPolicyInner 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.v3_2017_03.ServerSecurityAlertPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get a server'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. + * @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 ServerSecurityAlertPolicyInner object if successful. + */ + public ServerSecurityAlertPolicyInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Get a server'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 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); + } + + /** + * Get a server'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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerSecurityAlertPolicyInner>() { + @Override + public ServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a server'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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String securityAlertPolicyName = "Default"; + return service.get(resourceGroupName, serverName, 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 threat detection 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 parameters The server 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 ServerSecurityAlertPolicyInner object if successful. + */ + public ServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The server 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, ServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerSecurityAlertPolicyInner>() { + @Override + public ServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner 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 (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"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, 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 threat detection 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 parameters The server 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 ServerSecurityAlertPolicyInner object if successful. + */ + public ServerSecurityAlertPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The server 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerSecurityAlertPolicyInner>() { + @Override + public ServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerSecurityAlertPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner 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 (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.beginCreateOrUpdate(resourceGroupName, serverName, 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 = 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); + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..e12ed5fa95237 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyImpl.java @@ -0,0 +1,171 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.ServerSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_03.SecurityAlertPolicyState; +import java.util.List; + +class ServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ServerSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerSecurityAlertPolicyImpl(ServerSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerSecurityAlertPoliciesInner client = this.manager().inner().serverSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerSecurityAlertPoliciesInner client = this.manager().inner().serverSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerSecurityAlertPoliciesInner client = this.manager().inner().serverSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @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 ServerSecurityAlertPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyInner.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..5ac9ed1cfa336 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/ServerSecurityAlertPolicyInner.java @@ -0,0 +1,210 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.management.sql.v3_2017_03.SecurityAlertPolicyState; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server security alert policy. + */ +@JsonFlatten +public class ServerSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled. + * 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; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled. 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. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner 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 ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..e7292fef5ce17 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManagementClientImpl.java @@ -0,0 +1,504 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ExtendedDatabaseBlobAuditingPoliciesInner object to access its operations. + */ + private ExtendedDatabaseBlobAuditingPoliciesInner extendedDatabaseBlobAuditingPolicies; + + /** + * Gets the ExtendedDatabaseBlobAuditingPoliciesInner object to access its operations. + * @return the ExtendedDatabaseBlobAuditingPoliciesInner object. + */ + public ExtendedDatabaseBlobAuditingPoliciesInner extendedDatabaseBlobAuditingPolicies() { + return this.extendedDatabaseBlobAuditingPolicies; + } + + /** + * The ExtendedServerBlobAuditingPoliciesInner object to access its operations. + */ + private ExtendedServerBlobAuditingPoliciesInner extendedServerBlobAuditingPolicies; + + /** + * Gets the ExtendedServerBlobAuditingPoliciesInner object to access its operations. + * @return the ExtendedServerBlobAuditingPoliciesInner object. + */ + public ExtendedServerBlobAuditingPoliciesInner extendedServerBlobAuditingPolicies() { + return this.extendedServerBlobAuditingPolicies; + } + + /** + * The ServerBlobAuditingPoliciesInner object to access its operations. + */ + private ServerBlobAuditingPoliciesInner serverBlobAuditingPolicies; + + /** + * Gets the ServerBlobAuditingPoliciesInner object to access its operations. + * @return the ServerBlobAuditingPoliciesInner object. + */ + public ServerBlobAuditingPoliciesInner serverBlobAuditingPolicies() { + return this.serverBlobAuditingPolicies; + } + + /** + * The DatabaseBlobAuditingPoliciesInner object to access its operations. + */ + private DatabaseBlobAuditingPoliciesInner databaseBlobAuditingPolicies; + + /** + * Gets the DatabaseBlobAuditingPoliciesInner object to access its operations. + * @return the DatabaseBlobAuditingPoliciesInner object. + */ + public DatabaseBlobAuditingPoliciesInner databaseBlobAuditingPolicies() { + return this.databaseBlobAuditingPolicies; + } + + /** + * The DatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentRuleBaselinesInner databaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the DatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentRuleBaselinesInner object. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesInner databaseVulnerabilityAssessmentRuleBaselines() { + return this.databaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * The DatabaseVulnerabilityAssessmentsInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentsInner databaseVulnerabilityAssessments; + + /** + * Gets the DatabaseVulnerabilityAssessmentsInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentsInner object. + */ + public DatabaseVulnerabilityAssessmentsInner databaseVulnerabilityAssessments() { + return this.databaseVulnerabilityAssessments; + } + + /** + * The JobAgentsInner object to access its operations. + */ + private JobAgentsInner jobAgents; + + /** + * Gets the JobAgentsInner object to access its operations. + * @return the JobAgentsInner object. + */ + public JobAgentsInner jobAgents() { + return this.jobAgents; + } + + /** + * The JobCredentialsInner object to access its operations. + */ + private JobCredentialsInner jobCredentials; + + /** + * Gets the JobCredentialsInner object to access its operations. + * @return the JobCredentialsInner object. + */ + public JobCredentialsInner jobCredentials() { + return this.jobCredentials; + } + + /** + * The JobExecutionsInner object to access its operations. + */ + private JobExecutionsInner jobExecutions; + + /** + * Gets the JobExecutionsInner object to access its operations. + * @return the JobExecutionsInner object. + */ + public JobExecutionsInner jobExecutions() { + return this.jobExecutions; + } + + /** + * The JobsInner object to access its operations. + */ + private JobsInner jobs; + + /** + * Gets the JobsInner object to access its operations. + * @return the JobsInner object. + */ + public JobsInner jobs() { + return this.jobs; + } + + /** + * The JobStepExecutionsInner object to access its operations. + */ + private JobStepExecutionsInner jobStepExecutions; + + /** + * Gets the JobStepExecutionsInner object to access its operations. + * @return the JobStepExecutionsInner object. + */ + public JobStepExecutionsInner jobStepExecutions() { + return this.jobStepExecutions; + } + + /** + * The JobStepsInner object to access its operations. + */ + private JobStepsInner jobSteps; + + /** + * Gets the JobStepsInner object to access its operations. + * @return the JobStepsInner object. + */ + public JobStepsInner jobSteps() { + return this.jobSteps; + } + + /** + * The JobTargetExecutionsInner object to access its operations. + */ + private JobTargetExecutionsInner jobTargetExecutions; + + /** + * Gets the JobTargetExecutionsInner object to access its operations. + * @return the JobTargetExecutionsInner object. + */ + public JobTargetExecutionsInner jobTargetExecutions() { + return this.jobTargetExecutions; + } + + /** + * The JobTargetGroupsInner object to access its operations. + */ + private JobTargetGroupsInner jobTargetGroups; + + /** + * Gets the JobTargetGroupsInner object to access its operations. + * @return the JobTargetGroupsInner object. + */ + public JobTargetGroupsInner jobTargetGroups() { + return this.jobTargetGroups; + } + + /** + * The JobVersionsInner object to access its operations. + */ + private JobVersionsInner jobVersions; + + /** + * Gets the JobVersionsInner object to access its operations. + * @return the JobVersionsInner object. + */ + public JobVersionsInner jobVersions() { + return this.jobVersions; + } + + /** + * The LongTermRetentionBackupsInner object to access its operations. + */ + private LongTermRetentionBackupsInner longTermRetentionBackups; + + /** + * Gets the LongTermRetentionBackupsInner object to access its operations. + * @return the LongTermRetentionBackupsInner object. + */ + public LongTermRetentionBackupsInner longTermRetentionBackups() { + return this.longTermRetentionBackups; + } + + /** + * The BackupLongTermRetentionPoliciesInner object to access its operations. + */ + private BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies; + + /** + * Gets the BackupLongTermRetentionPoliciesInner object to access its operations. + * @return the BackupLongTermRetentionPoliciesInner object. + */ + public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { + return this.backupLongTermRetentionPolicies; + } + + /** + * The ManagedBackupShortTermRetentionPoliciesInner object to access its operations. + */ + private ManagedBackupShortTermRetentionPoliciesInner managedBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedBackupShortTermRetentionPoliciesInner object to access its operations. + * @return the ManagedBackupShortTermRetentionPoliciesInner object. + */ + public ManagedBackupShortTermRetentionPoliciesInner managedBackupShortTermRetentionPolicies() { + return this.managedBackupShortTermRetentionPolicies; + } + + /** + * 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 ServerAutomaticTuningsInner object to access its operations. + */ + private ServerAutomaticTuningsInner serverAutomaticTunings; + + /** + * Gets the ServerAutomaticTuningsInner object to access its operations. + * @return the ServerAutomaticTuningsInner object. + */ + public ServerAutomaticTuningsInner serverAutomaticTunings() { + return this.serverAutomaticTunings; + } + + /** + * The ServerDnsAliasesInner object to access its operations. + */ + private ServerDnsAliasesInner serverDnsAliases; + + /** + * Gets the ServerDnsAliasesInner object to access its operations. + * @return the ServerDnsAliasesInner object. + */ + public ServerDnsAliasesInner serverDnsAliases() { + return this.serverDnsAliases; + } + + /** + * The ServerSecurityAlertPoliciesInner object to access its operations. + */ + private ServerSecurityAlertPoliciesInner serverSecurityAlertPolicies; + + /** + * Gets the ServerSecurityAlertPoliciesInner object to access its operations. + * @return the ServerSecurityAlertPoliciesInner object. + */ + public ServerSecurityAlertPoliciesInner serverSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; + } + + /** + * The RestorePointsInner object to access its operations. + */ + private RestorePointsInner restorePoints; + + /** + * Gets the RestorePointsInner object to access its operations. + * @return the RestorePointsInner object. + */ + public RestorePointsInner restorePoints() { + return this.restorePoints; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-03-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.extendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.extendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.serverBlobAuditingPolicies = new ServerBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.jobAgents = new JobAgentsInner(restClient().retrofit(), this); + this.jobCredentials = new JobCredentialsInner(restClient().retrofit(), this); + this.jobExecutions = new JobExecutionsInner(restClient().retrofit(), this); + this.jobs = new JobsInner(restClient().retrofit(), this); + this.jobStepExecutions = new JobStepExecutionsInner(restClient().retrofit(), this); + this.jobSteps = new JobStepsInner(restClient().retrofit(), this); + this.jobTargetExecutions = new JobTargetExecutionsInner(restClient().retrofit(), this); + this.jobTargetGroups = new JobTargetGroupsInner(restClient().retrofit(), this); + this.jobVersions = new JobVersionsInner(restClient().retrofit(), this); + this.longTermRetentionBackups = new LongTermRetentionBackupsInner(restClient().retrofit(), this); + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); + this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); + this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); + this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); + this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2017-03-01-preview"); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManager.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManager.java new file mode 100644 index 0000000000000..c070724b479b8 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/SqlManager.java @@ -0,0 +1,363 @@ +/** + * 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.v3_2017_03.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedDatabaseBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v3_2017_03.ExtendedServerBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v3_2017_03.ServerBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseBlobAuditingPolicies; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessmentRuleBaselines; +import com.microsoft.azure.management.sql.v3_2017_03.DatabaseVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v3_2017_03.JobAgents; +import com.microsoft.azure.management.sql.v3_2017_03.JobCredentials; +import com.microsoft.azure.management.sql.v3_2017_03.JobExecutions; +import com.microsoft.azure.management.sql.v3_2017_03.Jobs; +import com.microsoft.azure.management.sql.v3_2017_03.JobStepExecutions; +import com.microsoft.azure.management.sql.v3_2017_03.JobSteps; +import com.microsoft.azure.management.sql.v3_2017_03.JobTargetExecutions; +import com.microsoft.azure.management.sql.v3_2017_03.JobTargetGroups; +import com.microsoft.azure.management.sql.v3_2017_03.JobVersions; +import com.microsoft.azure.management.sql.v3_2017_03.LongTermRetentionBackups; +import com.microsoft.azure.management.sql.v3_2017_03.BackupLongTermRetentionPolicies; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedBackupShortTermRetentionPolicies; +import com.microsoft.azure.management.sql.v3_2017_03.ManagedDatabases; +import com.microsoft.azure.management.sql.v3_2017_03.ServerAutomaticTunings; +import com.microsoft.azure.management.sql.v3_2017_03.ServerDnsAliases; +import com.microsoft.azure.management.sql.v3_2017_03.ServerSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v3_2017_03.RestorePoints; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies; + private ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies; + private ServerBlobAuditingPolicies serverBlobAuditingPolicies; + private DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies; + private DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines; + private DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments; + private JobAgents jobAgents; + private JobCredentials jobCredentials; + private JobExecutions jobExecutions; + private Jobs jobs; + private JobStepExecutions jobStepExecutions; + private JobSteps jobSteps; + private JobTargetExecutions jobTargetExecutions; + private JobTargetGroups jobTargetGroups; + private JobVersions jobVersions; + private LongTermRetentionBackups longTermRetentionBackups; + private BackupLongTermRetentionPolicies backupLongTermRetentionPolicies; + private ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies; + private ManagedDatabases managedDatabases; + private ServerAutomaticTunings serverAutomaticTunings; + private ServerDnsAliases serverDnsAliases; + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + private RestorePoints restorePoints; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ExtendedDatabaseBlobAuditingPolicies. + */ + public ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies() { + if (this.extendedDatabaseBlobAuditingPolicies == null) { + this.extendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesImpl(this); + } + return this.extendedDatabaseBlobAuditingPolicies; + } + + /** + * @return Entry point to manage ExtendedServerBlobAuditingPolicies. + */ + public ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies() { + if (this.extendedServerBlobAuditingPolicies == null) { + this.extendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesImpl(this); + } + return this.extendedServerBlobAuditingPolicies; + } + + /** + * @return Entry point to manage ServerBlobAuditingPolicies. + */ + public ServerBlobAuditingPolicies serverBlobAuditingPolicies() { + if (this.serverBlobAuditingPolicies == null) { + this.serverBlobAuditingPolicies = new ServerBlobAuditingPoliciesImpl(this); + } + return this.serverBlobAuditingPolicies; + } + + /** + * @return Entry point to manage DatabaseBlobAuditingPolicies. + */ + public DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies() { + if (this.databaseBlobAuditingPolicies == null) { + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesImpl(this); + } + return this.databaseBlobAuditingPolicies; + } + + /** + * @return Entry point to manage DatabaseVulnerabilityAssessmentRuleBaselines. + */ + public DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines() { + if (this.databaseVulnerabilityAssessmentRuleBaselines == null) { + this.databaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesImpl(this); + } + return this.databaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * @return Entry point to manage DatabaseVulnerabilityAssessments. + */ + public DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments() { + if (this.databaseVulnerabilityAssessments == null) { + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsImpl(this); + } + return this.databaseVulnerabilityAssessments; + } + + /** + * @return Entry point to manage JobAgents. + */ + public JobAgents jobAgents() { + if (this.jobAgents == null) { + this.jobAgents = new JobAgentsImpl(this); + } + return this.jobAgents; + } + + /** + * @return Entry point to manage JobCredentials. + */ + public JobCredentials jobCredentials() { + if (this.jobCredentials == null) { + this.jobCredentials = new JobCredentialsImpl(this); + } + return this.jobCredentials; + } + + /** + * @return Entry point to manage JobExecutions. + */ + public JobExecutions jobExecutions() { + if (this.jobExecutions == null) { + this.jobExecutions = new JobExecutionsImpl(this); + } + return this.jobExecutions; + } + + /** + * @return Entry point to manage Jobs. + */ + public Jobs jobs() { + if (this.jobs == null) { + this.jobs = new JobsImpl(this); + } + return this.jobs; + } + + /** + * @return Entry point to manage JobStepExecutions. + */ + public JobStepExecutions jobStepExecutions() { + if (this.jobStepExecutions == null) { + this.jobStepExecutions = new JobStepExecutionsImpl(this); + } + return this.jobStepExecutions; + } + + /** + * @return Entry point to manage JobSteps. + */ + public JobSteps jobSteps() { + if (this.jobSteps == null) { + this.jobSteps = new JobStepsImpl(this); + } + return this.jobSteps; + } + + /** + * @return Entry point to manage JobTargetExecutions. + */ + public JobTargetExecutions jobTargetExecutions() { + if (this.jobTargetExecutions == null) { + this.jobTargetExecutions = new JobTargetExecutionsImpl(this); + } + return this.jobTargetExecutions; + } + + /** + * @return Entry point to manage JobTargetGroups. + */ + public JobTargetGroups jobTargetGroups() { + if (this.jobTargetGroups == null) { + this.jobTargetGroups = new JobTargetGroupsImpl(this); + } + return this.jobTargetGroups; + } + + /** + * @return Entry point to manage JobVersions. + */ + public JobVersions jobVersions() { + if (this.jobVersions == null) { + this.jobVersions = new JobVersionsImpl(this); + } + return this.jobVersions; + } + + /** + * @return Entry point to manage LongTermRetentionBackups. + */ + public LongTermRetentionBackups longTermRetentionBackups() { + if (this.longTermRetentionBackups == null) { + this.longTermRetentionBackups = new LongTermRetentionBackupsImpl(this); + } + return this.longTermRetentionBackups; + } + + /** + * @return Entry point to manage BackupLongTermRetentionPolicies. + */ + public BackupLongTermRetentionPolicies backupLongTermRetentionPolicies() { + if (this.backupLongTermRetentionPolicies == null) { + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesImpl(this); + } + return this.backupLongTermRetentionPolicies; + } + + /** + * @return Entry point to manage ManagedBackupShortTermRetentionPolicies. + */ + public ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies() { + if (this.managedBackupShortTermRetentionPolicies == null) { + this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesImpl(this); + } + return this.managedBackupShortTermRetentionPolicies; + } + + /** + * @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 ServerAutomaticTunings. + */ + public ServerAutomaticTunings serverAutomaticTunings() { + if (this.serverAutomaticTunings == null) { + this.serverAutomaticTunings = new ServerAutomaticTuningsImpl(this); + } + return this.serverAutomaticTunings; + } + + /** + * @return Entry point to manage ServerDnsAliases. + */ + public ServerDnsAliases serverDnsAliases() { + if (this.serverDnsAliases == null) { + this.serverDnsAliases = new ServerDnsAliasesImpl(this); + } + return this.serverDnsAliases; + } + + /** + * @return Entry point to manage ServerSecurityAlertPolicies. + */ + public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { + if (this.serverSecurityAlertPolicies == null) { + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesImpl(this); + } + return this.serverSecurityAlertPolicies; + } + + /** + * @return Entry point to manage RestorePoints. + */ + public RestorePoints restorePoints() { + if (this.restorePoints == null) { + this.restorePoints = new RestorePointsImpl(this); + } + return this.restorePoints; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/package-info.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/package-info.java new file mode 100644 index 0000000000000..d7de913a76b2c --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2017_03.implementation; diff --git a/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/package-info.java b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/package-info.java new file mode 100644 index 0000000000000..dfea91b6048c4 --- /dev/null +++ b/sql/resource-manager/v3_2017_03/src/main/java/com/microsoft/azure/management/sql/v3_2017_03/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2017_03; diff --git a/sql/resource-manager/v3_2017_10/pom.xml b/sql/resource-manager/v3_2017_10/pom.xml new file mode 100644 index 0000000000000..5820e94fb9144 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v3_2017_10 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicies.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..b1f741ef1db9d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicies.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.v3_2017_10; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.BackupShortTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BackupShortTermRetentionPolicies. + */ +public interface BackupShortTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a database's short 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 serverName The name of the server. + * @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 serverName, String databaseName); + + /** + * Gets a database's short 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 serverName The name of the server. + * @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 serverName, final String databaseName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicy.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..a9989a1715c5c --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/BackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.BackupShortTermRetentionPolicyInner; +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.v3_2017_10.implementation.SqlManager; + +/** + * Type representing BackupShortTermRetentionPolicy. + */ +public interface BackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the BackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the backupshorttermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * 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 { + } + } + /** + * The template for a BackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of BackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Capabilities.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Capabilities.java new file mode 100644 index 0000000000000..94cbc06d23b07 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Capabilities.java @@ -0,0 +1,26 @@ +/** + * 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.v3_2017_10; + +import rx.Observable; + +/** + * Type representing Capabilities. + */ +public interface Capabilities { + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(String locationName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityGroup.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityGroup.java new file mode 100644 index 0000000000000..826d39e450d31 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityGroup.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CapabilityGroup. + */ +public final class CapabilityGroup extends ExpandableStringEnum { + /** Static value supportedEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_EDITIONS = fromString("supportedEditions"); + + /** Static value supportedElasticPoolEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_ELASTIC_POOL_EDITIONS = fromString("supportedElasticPoolEditions"); + + /** Static value supportedManagedInstanceVersions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_MANAGED_INSTANCE_VERSIONS = fromString("supportedManagedInstanceVersions"); + + /** + * Creates or finds a CapabilityGroup from its string representation. + * @param name a name to look for + * @return the corresponding CapabilityGroup + */ + @JsonCreator + public static CapabilityGroup fromString(String name) { + return fromString(name, CapabilityGroup.class); + } + + /** + * @return known CapabilityGroup values + */ + public static Collection values() { + return values(CapabilityGroup.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityStatus.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityStatus.java new file mode 100644 index 0000000000000..c5ccd5589be46 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CapabilityStatus.java @@ -0,0 +1,59 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CapabilityStatus. + */ +public enum CapabilityStatus { + /** Enum value Visible. */ + VISIBLE("Visible"), + + /** Enum value Available. */ + AVAILABLE("Available"), + + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a CapabilityStatus instance. */ + private String value; + + CapabilityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CapabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed CapabilityStatus object, or null if unable to parse. + */ + @JsonCreator + public static CapabilityStatus fromString(String value) { + CapabilityStatus[] items = CapabilityStatus.values(); + for (CapabilityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CatalogCollationType.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CatalogCollationType.java new file mode 100644 index 0000000000000..29fb85ef9266d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/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.v3_2017_10; + +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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CreateMode.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CreateMode.java new file mode 100644 index 0000000000000..5ff491233211a --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/CreateMode.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CreateMode. + */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value Copy for CreateMode. */ + public static final CreateMode COPY = fromString("Copy"); + + /** Static value Secondary for CreateMode. */ + public static final CreateMode SECONDARY = fromString("Secondary"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** Static value Recovery for CreateMode. */ + public static final CreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreExternalBackup for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value RestoreExternalBackupSecondary for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP_SECONDARY = fromString("RestoreExternalBackupSecondary"); + + /** Static value RestoreLongTermRetentionBackup for CreateMode. */ + public static final CreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** Static value OnlineSecondary for CreateMode. */ + public static final CreateMode ONLINE_SECONDARY = fromString("OnlineSecondary"); + + /** + * Creates or finds a CreateMode from its string representation. + * @param name a name to look for + * @return the corresponding CreateMode + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * @return known CreateMode values + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Database.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Database.java new file mode 100644 index 0000000000000..f16b0e7b02815 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Database.java @@ -0,0 +1,613 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.DatabaseInner; +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.v3_2017_10.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing Database. + */ +public interface Database extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the currentServiceObjectiveName value. + */ + String currentServiceObjectiveName(); + + /** + * @return the currentSku value. + */ + Sku currentSku(); + + /** + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the elasticPoolId value. + */ + String elasticPoolId(); + + /** + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the licenseType value. + */ + DatabaseLicenseType licenseType(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the maxLogSizeBytes value. + */ + Long maxLogSizeBytes(); + + /** + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the readScale value. + */ + DatabaseReadScale readScale(); + + /** + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * @return the recoveryServicesRecoveryPointId value. + */ + String recoveryServicesRecoveryPointId(); + + /** + * @return the requestedServiceObjectiveName value. + */ + String requestedServiceObjectiveName(); + + /** + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the sourceDatabaseDeletionDate value. + */ + DateTime sourceDatabaseDeletionDate(); + + /** + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * @return the status value. + */ + DatabaseStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the Database definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Database definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Database definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the database definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the database definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the database definition allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the database definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database definition allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + WithCreate withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(DatabaseLicenseType licenseType); + } + + /** + * The stage of the database definition allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database definition allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + WithCreate withReadScale(DatabaseReadScale readScale); + } + + /** + * The stage of the database definition allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + WithCreate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database definition allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database definition allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + WithCreate withSampleName(SampleName sampleName); + } + + /** + * The stage of the database definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + WithCreate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the database definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithElasticPoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithLongTermRetentionBackupResourceId, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithReadScale, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRecoveryServicesRecoveryPointId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSku, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a Database update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithElasticPoolId, UpdateStages.WithLicenseType, UpdateStages.WithLongTermRetentionBackupResourceId, UpdateStages.WithMaxSizeBytes, UpdateStages.WithReadScale, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRecoveryServicesRecoveryPointId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSku, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of Database update stages. + */ + interface UpdateStages { + /** + * The stage of the database update allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the database update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database update allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + Update withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(DatabaseLicenseType licenseType); + } + + /** + * The stage of the database update allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + Update withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database update allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + Update withReadScale(DatabaseReadScale readScale); + } + + /** + * The stage of the database update allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database update allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + Update withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database update allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database update allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + Update withSampleName(SampleName sampleName); + } + + /** + * The stage of the database update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + Update withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the database update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseLicenseType.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseLicenseType.java new file mode 100644 index 0000000000000..84940be7f3528 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseLicenseType.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseLicenseType. + */ +public final class DatabaseLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for DatabaseLicenseType. */ + public static final DatabaseLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for DatabaseLicenseType. */ + public static final DatabaseLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a DatabaseLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseLicenseType + */ + @JsonCreator + public static DatabaseLicenseType fromString(String name) { + return fromString(name, DatabaseLicenseType.class); + } + + /** + * @return known DatabaseLicenseType values + */ + public static Collection values() { + return values(DatabaseLicenseType.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperation.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperation.java new file mode 100644 index 0000000000000..25dd6b3298a92 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperation.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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.DatabaseOperationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing DatabaseOperation. + */ +public interface DatabaseOperation extends HasInner, HasManager { + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @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 name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + ManagementOperationState state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperations.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperations.java new file mode 100644 index 0000000000000..c44e2aede5a19 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseOperations.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.v3_2017_10; + +import rx.Observable; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.DatabaseOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseOperations. + */ +public interface DatabaseOperations extends HasInner { + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId); + + /** + * Gets a list of operations performed on the 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. + * @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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseReadScale.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseReadScale.java new file mode 100644 index 0000000000000..29a7d939d9d10 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseReadScale.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseReadScale. + */ +public final class DatabaseReadScale extends ExpandableStringEnum { + /** Static value Enabled for DatabaseReadScale. */ + public static final DatabaseReadScale ENABLED = fromString("Enabled"); + + /** Static value Disabled for DatabaseReadScale. */ + public static final DatabaseReadScale DISABLED = fromString("Disabled"); + + /** + * Creates or finds a DatabaseReadScale from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseReadScale + */ + @JsonCreator + public static DatabaseReadScale fromString(String name) { + return fromString(name, DatabaseReadScale.class); + } + + /** + * @return known DatabaseReadScale values + */ + public static Collection values() { + return values(DatabaseReadScale.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseStatus.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseStatus.java new file mode 100644 index 0000000000000..1cc858dfe1b03 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseStatus.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseStatus. + */ +public final class DatabaseStatus extends ExpandableStringEnum { + /** Static value Online for DatabaseStatus. */ + public static final DatabaseStatus ONLINE = fromString("Online"); + + /** Static value Restoring for DatabaseStatus. */ + public static final DatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value RecoveryPending for DatabaseStatus. */ + public static final DatabaseStatus RECOVERY_PENDING = fromString("RecoveryPending"); + + /** Static value Recovering for DatabaseStatus. */ + public static final DatabaseStatus RECOVERING = fromString("Recovering"); + + /** Static value Suspect for DatabaseStatus. */ + public static final DatabaseStatus SUSPECT = fromString("Suspect"); + + /** Static value Offline for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Standby for DatabaseStatus. */ + public static final DatabaseStatus STANDBY = fromString("Standby"); + + /** Static value Shutdown for DatabaseStatus. */ + public static final DatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value EmergencyMode for DatabaseStatus. */ + public static final DatabaseStatus EMERGENCY_MODE = fromString("EmergencyMode"); + + /** Static value AutoClosed for DatabaseStatus. */ + public static final DatabaseStatus AUTO_CLOSED = fromString("AutoClosed"); + + /** Static value Copying for DatabaseStatus. */ + public static final DatabaseStatus COPYING = fromString("Copying"); + + /** Static value Creating for DatabaseStatus. */ + public static final DatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for DatabaseStatus. */ + public static final DatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value OfflineSecondary for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_SECONDARY = fromString("OfflineSecondary"); + + /** Static value Pausing for DatabaseStatus. */ + public static final DatabaseStatus PAUSING = fromString("Pausing"); + + /** Static value Paused for DatabaseStatus. */ + public static final DatabaseStatus PAUSED = fromString("Paused"); + + /** Static value Resuming for DatabaseStatus. */ + public static final DatabaseStatus RESUMING = fromString("Resuming"); + + /** Static value Scaling for DatabaseStatus. */ + public static final DatabaseStatus SCALING = fromString("Scaling"); + + /** + * Creates or finds a DatabaseStatus from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseStatus + */ + @JsonCreator + public static DatabaseStatus fromString(String name) { + return fromString(name, DatabaseStatus.class); + } + + /** + * @return known DatabaseStatus values + */ + public static Collection values() { + return values(DatabaseStatus.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseUpdate.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseUpdate.java new file mode 100644 index 0000000000000..ba9d17c7de1a1 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseUpdate.java @@ -0,0 +1,712 @@ +/** + * 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.v3_2017_10; + +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseUpdate { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * 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; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this database. Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /** + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @param createMode the createMode value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the max log size for this database. + * + * @return the maxLogSizeBytes value + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the name and tier of the SKU. + * + * @return the currentSku value + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessment.java new file mode 100644 index 0000000000000..b69be60246675 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessment.java @@ -0,0 +1,185 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.DatabaseVulnerabilityAssessmentInner; +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.v3_2017_10.implementation.SqlManager; + +/** + * Type representing DatabaseVulnerabilityAssessment. + */ +public interface DatabaseVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessment definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a DatabaseVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerPath, UpdateStages.WithStorageContainerSasKey { + } + + /** + * Grouping of DatabaseVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + Update withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaseline.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..e553022afb891 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaseline.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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.DatabaseVulnerabilityAssessmentRuleBaselineInner; +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.v3_2017_10.implementation.SqlManager; +import java.util.List; + +/** + * Type representing DatabaseVulnerabilityAssessmentRuleBaseline. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaseline extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the baselineResults value. + */ + List baselineResults(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRule, DefinitionStages.WithBaselineResults, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Blank extends WithRule { + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify Rule. + */ + interface WithRule { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName, ruleId. + */ + WithBaselineResults withExistingRule(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId); + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + WithCreate withBaselineResults(List baselineResults); + } + + /** + * 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 { + } + } + /** + * The template for a DatabaseVulnerabilityAssessmentRuleBaseline update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBaselineResults { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessmentrulebaseline update allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + Update withBaselineResults(List baselineResults); + } + + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 0000000000000..ab37736d53255 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentRuleBaselineItem.java @@ -0,0 +1,45 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for an Azure SQL Database Vulnerability Assessment rule + * baseline's result. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /** + * The rule baseline result. + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** + * Get the rule baseline result. + * + * @return the result value + */ + public List result() { + return this.result; + } + + /** + * Set the rule baseline result. + * + * @param result the result value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineItem object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem withResult(List result) { + this.result = result; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..1265d57153ec1 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScans.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.v3_2017_10; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.ServerVulnerabilityAssessmentScanRecord; +import rx.Completable; + +/** + * Type representing DatabaseVulnerabilityAssessmentScans. + */ +public interface DatabaseVulnerabilityAssessmentScans { + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + + /** + * Lists the vulnerability assessment scans of 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. + * @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); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScansExport.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScansExport.java new file mode 100644 index 0000000000000..1728ba08e2562 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/DatabaseVulnerabilityAssessmentScansExport.java @@ -0,0 +1,40 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.DatabaseVulnerabilityAssessmentScansExportInner; + +/** + * Type representing DatabaseVulnerabilityAssessmentScansExport. + */ +public interface DatabaseVulnerabilityAssessmentScansExport extends HasInner, HasManager { + /** + * @return the exportedReportLocation value. + */ + String exportedReportLocation(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Databases.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Databases.java new file mode 100644 index 0000000000000..c15a6ce943779 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Databases.java @@ -0,0 +1,109 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.DatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Databases. + */ +public interface Databases extends SupportsCreating, HasInner { + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName); + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable pauseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable resumeAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id); + + /** + * Gets 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. + * @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 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 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 the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/EditionCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/EditionCapability.java new file mode 100644 index 0000000000000..94e20b5e85955 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/EditionCapability.java @@ -0,0 +1,105 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The edition capability. + */ +public class EditionCapability { + /** + * The database edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported service objectives for the edition. + */ + @JsonProperty(value = "supportedServiceLevelObjectives", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServiceLevelObjectives; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the database edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported service objectives for the edition. + * + * @return the supportedServiceLevelObjectives value + */ + public List supportedServiceLevelObjectives() { + return this.supportedServiceLevelObjectives; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the EditionCapability object itself. + */ + public EditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPool.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPool.java new file mode 100644 index 0000000000000..9bdca893b0680 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPool.java @@ -0,0 +1,267 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ElasticPoolInner; +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.v3_2017_10.implementation.SqlManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPool. + */ +public interface ElasticPool extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the licenseType value. + */ + ElasticPoolLicenseType licenseType(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the perDatabaseSettings value. + */ + ElasticPoolPerDatabaseSettings perDatabaseSettings(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the state value. + */ + ElasticPoolState state(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the ElasticPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ElasticPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ElasticPool definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the elasticpool definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the elasticpool definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the elasticpool definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(ElasticPoolLicenseType licenseType); + } + + /** + * The stage of the elasticpool definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the elasticpool definition allowing to specify PerDatabaseSettings. + */ + interface WithPerDatabaseSettings { + /** + * Specifies perDatabaseSettings. + */ + WithCreate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + + /** + * The stage of the elasticpool definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the elasticpool definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the elasticpool definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithLicenseType, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithPerDatabaseSettings, DefinitionStages.WithSku, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a ElasticPool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLicenseType, UpdateStages.WithMaxSizeBytes, UpdateStages.WithPerDatabaseSettings, UpdateStages.WithSku, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of ElasticPool update stages. + */ + interface UpdateStages { + /** + * The stage of the elasticpool update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(ElasticPoolLicenseType licenseType); + } + + /** + * The stage of the elasticpool update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the elasticpool update allowing to specify PerDatabaseSettings. + */ + interface WithPerDatabaseSettings { + /** + * Specifies perDatabaseSettings. + */ + Update withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + + /** + * The stage of the elasticpool update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the elasticpool update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the elasticpool update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolEditionCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolEditionCapability.java new file mode 100644 index 0000000000000..33bab7a00d49d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolEditionCapability.java @@ -0,0 +1,105 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The elastic pool edition capability. + */ +public class ElasticPoolEditionCapability { + /** + * The elastic pool edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported elastic pool DTU levels for the edition. + */ + @JsonProperty(value = "supportedElasticPoolPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolPerformanceLevels; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the elastic pool edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported elastic pool DTU levels for the edition. + * + * @return the supportedElasticPoolPerformanceLevels value + */ + public List supportedElasticPoolPerformanceLevels() { + return this.supportedElasticPoolPerformanceLevels; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolEditionCapability object itself. + */ + public ElasticPoolEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolLicenseType.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolLicenseType.java new file mode 100644 index 0000000000000..19b93c7cc3e05 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolLicenseType.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolLicenseType. + */ +public final class ElasticPoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ElasticPoolLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolLicenseType + */ + @JsonCreator + public static ElasticPoolLicenseType fromString(String name) { + return fromString(name, ElasticPoolLicenseType.class); + } + + /** + * @return known ElasticPoolLicenseType values + */ + public static Collection values() { + return values(ElasticPoolLicenseType.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperation.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperation.java new file mode 100644 index 0000000000000..fb2cca50b2592 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperation.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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ElasticPoolOperationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPoolOperation. + */ +public interface ElasticPoolOperation extends HasInner, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @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 name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperations.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperations.java new file mode 100644 index 0000000000000..58e68bfd04f4b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolOperations.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.v3_2017_10; + +import rx.Observable; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ElasticPoolOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolOperations. + */ +public interface ElasticPoolOperations extends HasInner { + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId); + + /** + * Gets a list of operations performed on the 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 String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java new file mode 100644 index 0000000000000..bbe8c2bc008e2 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The max per-database performance level capability. + */ +public class ElasticPoolPerDatabaseMaxPerformanceLevelCapability { + /** + * The maximum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * The list of supported min database performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMinPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMinPerformanceLevels; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the maximum performance level per database. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the list of supported min database performance levels. + * + * @return the supportedPerDatabaseMinPerformanceLevels value + */ + public List supportedPerDatabaseMinPerformanceLevels() { + return this.supportedPerDatabaseMinPerformanceLevels; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerDatabaseMaxPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMaxPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java new file mode 100644 index 0000000000000..539fa3365e58b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The minimum per-database performance level capability. + */ +public class ElasticPoolPerDatabaseMinPerformanceLevelCapability { + /** + * The minimum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the minimum performance level per database. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerDatabaseMinPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMinPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseSettings.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseSettings.java new file mode 100644 index 0000000000000..aedd6aaa79b8d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerDatabaseSettings.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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Per database settings of an elastic pool. + */ +public class ElasticPoolPerDatabaseSettings { + /** + * The minimum capacity all databases are guaranteed. + */ + @JsonProperty(value = "minCapacity") + private Double minCapacity; + + /** + * The maximum capacity any one database can consume. + */ + @JsonProperty(value = "maxCapacity") + private Double maxCapacity; + + /** + * Get the minimum capacity all databases are guaranteed. + * + * @return the minCapacity value + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minimum capacity all databases are guaranteed. + * + * @param minCapacity the minCapacity value to set + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the maximum capacity any one database can consume. + * + * @return the maxCapacity value + */ + public Double maxCapacity() { + return this.maxCapacity; + } + + /** + * Set the maximum capacity any one database can consume. + * + * @param maxCapacity the maxCapacity value to set + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMaxCapacity(Double maxCapacity) { + this.maxCapacity = maxCapacity; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerformanceLevelCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerformanceLevelCapability.java new file mode 100644 index 0000000000000..0fd480eee0a8c --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolPerformanceLevelCapability.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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Elastic Pool performance level capability. + */ +public class ElasticPoolPerformanceLevelCapability { + /** + * The performance level for the pool. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /** + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * The maximum number of databases supported. + */ + @JsonProperty(value = "maxDatabaseCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxDatabaseCount; + + /** + * The included (free) max size for this performance level. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * The list of supported max sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The list of supported per database max sizes. + */ + @JsonProperty(value = "supportedPerDatabaseMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxSizes; + + /** + * The list of supported per database max performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMaxPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxPerformanceLevels; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the performance level for the pool. + * + * @return the performanceLevel value + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the maximum number of databases supported. + * + * @return the maxDatabaseCount value + */ + public Integer maxDatabaseCount() { + return this.maxDatabaseCount; + } + + /** + * Get the included (free) max size for this performance level. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the list of supported max sizes. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the list of supported per database max sizes. + * + * @return the supportedPerDatabaseMaxSizes value + */ + public List supportedPerDatabaseMaxSizes() { + return this.supportedPerDatabaseMaxSizes; + } + + /** + * Get the list of supported per database max performance levels. + * + * @return the supportedPerDatabaseMaxPerformanceLevels value + */ + public List supportedPerDatabaseMaxPerformanceLevels() { + return this.supportedPerDatabaseMaxPerformanceLevels; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerformanceLevelCapability object itself. + */ + public ElasticPoolPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolState.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolState.java new file mode 100644 index 0000000000000..7322b37961a9d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolState.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolState. + */ +public final class ElasticPoolState extends ExpandableStringEnum { + /** Static value Creating for ElasticPoolState. */ + public static final ElasticPoolState CREATING = fromString("Creating"); + + /** Static value Ready for ElasticPoolState. */ + public static final ElasticPoolState READY = fromString("Ready"); + + /** Static value Disabled for ElasticPoolState. */ + public static final ElasticPoolState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ElasticPoolState from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolState + */ + @JsonCreator + public static ElasticPoolState fromString(String name) { + return fromString(name, ElasticPoolState.class); + } + + /** + * @return known ElasticPoolState values + */ + public static Collection values() { + return values(ElasticPoolState.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolUpdate.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolUpdate.java new file mode 100644 index 0000000000000..2aed8c3af7e8b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPoolUpdate.java @@ -0,0 +1,179 @@ +/** + * 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.v3_2017_10; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An elastic pool update. + */ +@JsonFlatten +public class ElasticPoolUpdate { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /** + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this elastic pool. Possible values + * include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the per database settings for the elastic pool. + * + * @return the perDatabaseSettings value + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + 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 ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPools.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPools.java new file mode 100644 index 0000000000000..a2fc301bf0f75 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ElasticPools.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.v3_2017_10; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPools. + */ +public interface ElasticPools extends SupportsCreating, HasInner { + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets all elastic pools in 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroup.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroup.java new file mode 100644 index 0000000000000..da6bace671aaa --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroup.java @@ -0,0 +1,166 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.InstanceFailoverGroupInner; +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.v3_2017_10.implementation.SqlManager; +import java.util.List; + +/** + * Type representing InstanceFailoverGroup. + */ +public interface InstanceFailoverGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the managedInstancePairs value. + */ + List managedInstancePairs(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerRegions value. + */ + List partnerRegions(); + + /** + * @return the readOnlyEndpoint value. + */ + InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * @return the readWriteEndpoint value. + */ + InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * @return the replicationRole value. + */ + InstanceFailoverGroupReplicationRole replicationRole(); + + /** + * @return the replicationState value. + */ + String replicationState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the InstanceFailoverGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithManagedInstancePairs, DefinitionStages.WithPartnerRegions, DefinitionStages.WithReadWriteEndpoint, DefinitionStages.WithCreate { + } + + /** + * Grouping of InstanceFailoverGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a InstanceFailoverGroup definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the instancefailovergroup definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies resourceGroupName, locationName. + */ + WithManagedInstancePairs withExistingLocation(String resourceGroupName, String locationName); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ManagedInstancePairs. + */ + interface WithManagedInstancePairs { + /** + * Specifies managedInstancePairs. + */ + WithPartnerRegions withManagedInstancePairs(List managedInstancePairs); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify PartnerRegions. + */ + interface WithPartnerRegions { + /** + * Specifies partnerRegions. + */ + WithReadWriteEndpoint withPartnerRegions(List partnerRegions); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ReadWriteEndpoint. + */ + interface WithReadWriteEndpoint { + /** + * Specifies readWriteEndpoint. + */ + WithCreate withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + WithCreate withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + /** + * 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.WithReadOnlyEndpoint { + } + } + /** + * The template for a InstanceFailoverGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithReadOnlyEndpoint { + } + + /** + * Grouping of InstanceFailoverGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the instancefailovergroup update allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + Update withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadOnlyEndpoint.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..da500f2eb644f --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadOnlyEndpoint.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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-only endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadOnlyEndpoint { + /** + * Failover policy of the read-only endpoint for the failover group. + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @return the failoverPolicy value + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadOnlyEndpoint object itself. + */ + public InstanceFailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadWriteEndpoint.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..1631d39df8ac2 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReadWriteEndpoint.java @@ -0,0 +1,73 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-write endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadWriteEndpoint { + /** + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /** + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @return the failoverPolicy value + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverWithDataLossGracePeriodMinutes value + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes(Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReplicationRole.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..fe406644d36c6 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroupReplicationRole.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InstanceFailoverGroupReplicationRole. + */ +public final class InstanceFailoverGroupReplicationRole extends ExpandableStringEnum { + /** Static value Primary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a InstanceFailoverGroupReplicationRole from its string representation. + * @param name a name to look for + * @return the corresponding InstanceFailoverGroupReplicationRole + */ + @JsonCreator + public static InstanceFailoverGroupReplicationRole fromString(String name) { + return fromString(name, InstanceFailoverGroupReplicationRole.class); + } + + /** + * @return known InstanceFailoverGroupReplicationRole values + */ + public static Collection values() { + return values(InstanceFailoverGroupReplicationRole.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroups.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroups.java new file mode 100644 index 0000000000000..622ad894221ef --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/InstanceFailoverGroups.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.InstanceFailoverGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InstanceFailoverGroups. + */ +public interface InstanceFailoverGroups extends SupportsCreating, HasInner { + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String resourceGroupName, final String locationName); + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LicenseTypeCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LicenseTypeCapability.java new file mode 100644 index 0000000000000..87105cf9b335f --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LicenseTypeCapability.java @@ -0,0 +1,74 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The license type capability. + */ +public class LicenseTypeCapability { + /** + * License type identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get license type identifier. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the LicenseTypeCapability object itself. + */ + public LicenseTypeCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LocationCapabilities.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LocationCapabilities.java new file mode 100644 index 0000000000000..1082aadbc3f42 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LocationCapabilities.java @@ -0,0 +1,46 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.LocationCapabilitiesInner; +import java.util.List; + +/** + * Type representing LocationCapabilities. + */ +public interface LocationCapabilities extends HasInner, HasManager { + /** + * @return the name value. + */ + String name(); + + /** + * @return the reason value. + */ + String reason(); + + /** + * @return the status value. + */ + CapabilityStatus status(); + + /** + * @return the supportedManagedInstanceVersions value. + */ + List supportedManagedInstanceVersions(); + + /** + * @return the supportedServerVersions value. + */ + List supportedServerVersions(); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeCapability.java new file mode 100644 index 0000000000000..1f262f482e2fe --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeCapability.java @@ -0,0 +1,48 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The log size capability. + */ +public class LogSizeCapability { + /** + * The log size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * The units that the limit is expressed in. Possible values include: + * 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeUnit unit; + + /** + * Get the log size limit (see 'unit' for the units). + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent'. + * + * @return the unit value + */ + public LogSizeUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeUnit.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeUnit.java new file mode 100644 index 0000000000000..830b3f2a33ccf --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/LogSizeUnit.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LogSizeUnit. + */ +public final class LogSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for LogSizeUnit. */ + public static final LogSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for LogSizeUnit. */ + public static final LogSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for LogSizeUnit. */ + public static final LogSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for LogSizeUnit. */ + public static final LogSizeUnit PETABYTES = fromString("Petabytes"); + + /** Static value Percent for LogSizeUnit. */ + public static final LogSizeUnit PERCENT = fromString("Percent"); + + /** + * Creates or finds a LogSizeUnit from its string representation. + * @param name a name to look for + * @return the corresponding LogSizeUnit + */ + @JsonCreator + public static LogSizeUnit fromString(String name) { + return fromString(name, LogSizeUnit.class); + } + + /** + * @return known LogSizeUnit values + */ + public static Collection values() { + return values(LogSizeUnit.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..33679cadbf191 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,51 @@ +/** + * 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.v3_2017_10; + +import rx.Observable; +import rx.Completable; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ +public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + /** + * Begins definition for a new Baseline resource. + * @param name resource name. + * @return the first stage of the new Baseline definition. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank defineBaseline(String name); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..aa586d60ee407 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,67 @@ +/** + * 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.v3_2017_10; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ManagedDatabaseVulnerabilityAssessmentScansInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessmentScans. + */ +public interface ManagedDatabaseVulnerabilityAssessmentScans extends HasInner { + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Lists the vulnerability assessment scans of 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 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessments.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..24a1e8f42f1b4 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedDatabaseVulnerabilityAssessments.java @@ -0,0 +1,59 @@ +/** + * 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.v3_2017_10; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessment; +import rx.Completable; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessments. + */ +public interface ManagedDatabaseVulnerabilityAssessments { + /** + * Begins definition for a new VulnerabilityAssessment resource. + * @param name resource name. + * @return the first stage of the new VulnerabilityAssessment definition. + */ + DatabaseVulnerabilityAssessment.DefinitionStages.Blank defineVulnerabilityAssessment(String name); + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment is defined. + * @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); + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEditionCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEditionCapability.java new file mode 100644 index 0000000000000..83d4146708389 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEditionCapability.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed server capability. + */ +public class ManagedInstanceEditionCapability { + /** + * The managed server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The supported families. + */ + @JsonProperty(value = "supportedFamilies", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFamilies; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the managed server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the supported families. + * + * @return the supportedFamilies value + */ + public List supportedFamilies() { + return this.supportedFamilies; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceEditionCapability object itself. + */ + public ManagedInstanceEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtector.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtector.java new file mode 100644 index 0000000000000..aa6dc99a2c49c --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtector.java @@ -0,0 +1,60 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.SqlManager; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ManagedInstanceEncryptionProtectorInner; + +/** + * Type representing ManagedInstanceEncryptionProtector. + */ +public interface ManagedInstanceEncryptionProtector extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtectors.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtectors.java new file mode 100644 index 0000000000000..3c3a0af1325d3 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceEncryptionProtectors.java @@ -0,0 +1,51 @@ +/** + * 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.v3_2017_10; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ManagedInstanceEncryptionProtectorInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ManagedInstanceEncryptionProtectorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceEncryptionProtectors. + */ +public interface ManagedInstanceEncryptionProtectors extends HasInner { + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The 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); + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 getAsync(String resourceGroupName, String managedInstanceName); + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceFamilyCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceFamilyCapability.java new file mode 100644 index 0000000000000..639569cf8c06f --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceFamilyCapability.java @@ -0,0 +1,150 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed server family capability. + */ +public class ManagedInstanceFamilyCapability { + /** + * Family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * SKU name. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * List of supported virtual cores values. + */ + @JsonProperty(value = "supportedVcoresValues", access = JsonProperty.Access.WRITE_ONLY) + private List supportedVcoresValues; + + /** + * Included size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * Storage size ranges. + */ + @JsonProperty(value = "supportedStorageSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageSizes; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get family name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get sKU name. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get list of supported virtual cores values. + * + * @return the supportedVcoresValues value + */ + public List supportedVcoresValues() { + return this.supportedVcoresValues; + } + + /** + * Get included size. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get storage size ranges. + * + * @return the supportedStorageSizes value + */ + public List supportedStorageSizes() { + return this.supportedStorageSizes; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceFamilyCapability object itself. + */ + public ManagedInstanceFamilyCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKey.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKey.java new file mode 100644 index 0000000000000..65246145bc41f --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKey.java @@ -0,0 +1,141 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ManagedInstanceKeyInner; +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.v3_2017_10.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ManagedInstanceKey. + */ +public interface ManagedInstanceKey extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + + /** + * The entirety of the ManagedInstanceKey definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithServerKeyType, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstanceKey definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstanceKey definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the managedinstancekey definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + */ + WithServerKeyType withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the managedinstancekey definition allowing to specify ServerKeyType. + */ + interface WithServerKeyType { + /** + * Specifies serverKeyType. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + + /** + * The stage of the managedinstancekey definition allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + WithCreate withUri(String uri); + } + + /** + * 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.WithUri { + } + } + /** + * The template for a ManagedInstanceKey update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithUri { + } + + /** + * Grouping of ManagedInstanceKey update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstancekey update allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + */ + Update withUri(String uri); + } + + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKeys.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKeys.java new file mode 100644 index 0000000000000..7daf10ccf47a9 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceKeys.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.v3_2017_10; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ManagedInstanceKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceKeys. + */ +public interface ManagedInstanceKeys extends SupportsCreating, HasInner { + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String keyName); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstancePairInfo.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstancePairInfo.java new file mode 100644 index 0000000000000..7255d9000abc5 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstancePairInfo.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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Pairs of Managed Instances in the failover group. + */ +public class ManagedInstancePairInfo { + /** + * Id of Primary Managed Instance in pair. + */ + @JsonProperty(value = "primaryManagedInstanceId") + private String primaryManagedInstanceId; + + /** + * Id of Partner Managed Instance in pair. + */ + @JsonProperty(value = "partnerManagedInstanceId") + private String partnerManagedInstanceId; + + /** + * Get id of Primary Managed Instance in pair. + * + * @return the primaryManagedInstanceId value + */ + public String primaryManagedInstanceId() { + return this.primaryManagedInstanceId; + } + + /** + * Set id of Primary Managed Instance in pair. + * + * @param primaryManagedInstanceId the primaryManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPrimaryManagedInstanceId(String primaryManagedInstanceId) { + this.primaryManagedInstanceId = primaryManagedInstanceId; + return this; + } + + /** + * Get id of Partner Managed Instance in pair. + * + * @return the partnerManagedInstanceId value + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set id of Partner Managed Instance in pair. + * + * @param partnerManagedInstanceId the partnerManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPartnerManagedInstanceId(String partnerManagedInstanceId) { + this.partnerManagedInstanceId = partnerManagedInstanceId; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceTdeCertificates.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceTdeCertificates.java new file mode 100644 index 0000000000000..de8030e4b837c --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceTdeCertificates.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2017_10; + +import rx.Completable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.TdeCertificateInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.ManagedInstanceTdeCertificatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceTdeCertificates. + */ +public interface ManagedInstanceTdeCertificates extends HasInner { + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVcoresCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVcoresCapability.java new file mode 100644 index 0000000000000..02e6187167a74 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVcoresCapability.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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed instance virtual cores capability. + */ +public class ManagedInstanceVcoresCapability { + /** + * The virtual cores identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The virtual cores value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Integer value; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the virtual cores identifier. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the virtual cores value. + * + * @return the value value + */ + public Integer value() { + return this.value; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceVcoresCapability object itself. + */ + public ManagedInstanceVcoresCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVersionCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVersionCapability.java new file mode 100644 index 0000000000000..18c27b8003d64 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVersionCapability.java @@ -0,0 +1,90 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed instance capability. + */ +public class ManagedInstanceVersionCapability { + /** + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported managed instance editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported managed instance editions. + * + * @return the supportedEditions value + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceVersionCapability object itself. + */ + public ManagedInstanceVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..ee790f7dd9a81 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagedInstanceVulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.VulnerabilityAssessmentScanRecordInner; +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.v3_2017_10.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ManagedInstanceVulnerabilityAssessmentScanRecord. + */ +public interface ManagedInstanceVulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagementOperationState.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ManagementOperationState.java new file mode 100644 index 0000000000000..60ef942d6940b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/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.v3_2017_10; + +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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeCapability.java new file mode 100644 index 0000000000000..c2e03bab8735c --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeCapability.java @@ -0,0 +1,48 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The maximum size capability. + */ +public class MaxSizeCapability { + /** + * The maximum size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * The units that the limit is expressed in. Possible values include: + * 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeUnit unit; + + /** + * Get the maximum size limit (see 'unit' for the units). + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + * + * @return the unit value + */ + public MaxSizeUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeRangeCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeRangeCapability.java new file mode 100644 index 0000000000000..cca2d221218f3 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeRangeCapability.java @@ -0,0 +1,120 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The maximum size range capability. + */ +public class MaxSizeRangeCapability { + /** + * Minimum value. + */ + @JsonProperty(value = "minValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability minValue; + + /** + * Maximum value. + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability maxValue; + + /** + * Scale/step size for discrete values between the minimum value and the + * maximum value. + */ + @JsonProperty(value = "scaleSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability scaleSize; + + /** + * Size of transaction log. + */ + @JsonProperty(value = "logSize", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeCapability logSize; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get minimum value. + * + * @return the minValue value + */ + public MaxSizeCapability minValue() { + return this.minValue; + } + + /** + * Get maximum value. + * + * @return the maxValue value + */ + public MaxSizeCapability maxValue() { + return this.maxValue; + } + + /** + * Get scale/step size for discrete values between the minimum value and the maximum value. + * + * @return the scaleSize value + */ + public MaxSizeCapability scaleSize() { + return this.scaleSize; + } + + /** + * Get size of transaction log. + * + * @return the logSize value + */ + public LogSizeCapability logSize() { + return this.logSize; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the MaxSizeRangeCapability object itself. + */ + public MaxSizeRangeCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeUnit.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeUnit.java new file mode 100644 index 0000000000000..a510329e37374 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/MaxSizeUnit.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MaxSizeUnit. + */ +public final class MaxSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for MaxSizeUnit. */ + public static final MaxSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for MaxSizeUnit. */ + public static final MaxSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for MaxSizeUnit. */ + public static final MaxSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for MaxSizeUnit. */ + public static final MaxSizeUnit PETABYTES = fromString("Petabytes"); + + /** + * Creates or finds a MaxSizeUnit from its string representation. + * @param name a name to look for + * @return the corresponding MaxSizeUnit + */ + @JsonCreator + public static MaxSizeUnit fromString(String name) { + return fromString(name, MaxSizeUnit.class); + } + + /** + * @return known MaxSizeUnit values + */ + public static Collection values() { + return values(MaxSizeUnit.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PartnerRegionInfo.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PartnerRegionInfo.java new file mode 100644 index 0000000000000..c07daed256af6 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PartnerRegionInfo.java @@ -0,0 +1,59 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Partner region information for the failover group. + */ +public class PartnerRegionInfo { + /** + * Geo location of the partner managed instances. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Replication role of the partner managed instances. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Get geo location of the partner managed instances. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set geo location of the partner managed instances. + * + * @param location the location value to set + * @return the PartnerRegionInfo object itself. + */ + public PartnerRegionInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get replication role of the partner managed instances. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelCapability.java new file mode 100644 index 0000000000000..513e5f9efd094 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelCapability.java @@ -0,0 +1,48 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The performance level capability. + */ +public class PerformanceLevelCapability { + /** + * Performance level value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * Get performance level value. + * + * @return the value value + */ + public Double value() { + return this.value; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelUnit.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelUnit.java new file mode 100644 index 0000000000000..3ec5defb5f08e --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/PerformanceLevelUnit.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PerformanceLevelUnit. + */ +public final class PerformanceLevelUnit extends ExpandableStringEnum { + /** Static value DTU for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit DTU = fromString("DTU"); + + /** Static value VCores for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit VCORES = fromString("VCores"); + + /** + * Creates or finds a PerformanceLevelUnit from its string representation. + * @param name a name to look for + * @return the corresponding PerformanceLevelUnit + */ + @JsonCreator + public static PerformanceLevelUnit fromString(String name) { + return fromString(name, PerformanceLevelUnit.class); + } + + /** + * @return known PerformanceLevelUnit values + */ + public static Collection values() { + return values(PerformanceLevelUnit.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadOnlyEndpointFailoverPolicy.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadOnlyEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..2f215601fa3f8 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadOnlyEndpointFailoverPolicy.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadOnlyEndpointFailoverPolicy. + */ +public final class ReadOnlyEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Disabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy DISABLED = fromString("Disabled"); + + /** Static value Enabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy ENABLED = fromString("Enabled"); + + /** + * Creates or finds a ReadOnlyEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadOnlyEndpointFailoverPolicy + */ + @JsonCreator + public static ReadOnlyEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadOnlyEndpointFailoverPolicy.class); + } + + /** + * @return known ReadOnlyEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadOnlyEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadWriteEndpointFailoverPolicy.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadWriteEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..7ad279913e493 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ReadWriteEndpointFailoverPolicy.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadWriteEndpointFailoverPolicy. + */ +public final class ReadWriteEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Manual for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy MANUAL = fromString("Manual"); + + /** Static value Automatic for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a ReadWriteEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadWriteEndpointFailoverPolicy + */ + @JsonCreator + public static ReadWriteEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadWriteEndpointFailoverPolicy.class); + } + + /** + * @return known ReadWriteEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadWriteEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ResourceMoveDefinition.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ResourceMoveDefinition.java new file mode 100644 index 0000000000000..de06d8276e285 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ResourceMoveDefinition.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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a resource move (rename). + */ +public class ResourceMoveDefinition { + /** + * The target ID for the resource. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the target ID for the resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the target ID for the resource. + * + * @param id the id value to set + * @return the ResourceMoveDefinition object itself. + */ + public ResourceMoveDefinition withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/SampleName.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/SampleName.java new file mode 100644 index 0000000000000..8ec25ad042583 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/SampleName.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SampleName. + */ +public final class SampleName extends ExpandableStringEnum { + /** Static value AdventureWorksLT for SampleName. */ + public static final SampleName ADVENTURE_WORKS_LT = fromString("AdventureWorksLT"); + + /** Static value WideWorldImportersStd for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_STD = fromString("WideWorldImportersStd"); + + /** Static value WideWorldImportersFull for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_FULL = fromString("WideWorldImportersFull"); + + /** + * Creates or finds a SampleName from its string representation. + * @param name a name to look for + * @return the corresponding SampleName + */ + @JsonCreator + public static SampleName fromString(String name) { + return fromString(name, SampleName.class); + } + + /** + * @return known SampleName values + */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerKeyType.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerKeyType.java new file mode 100644 index 0000000000000..787da9fdfb88b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerKeyType.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServerKeyType. + */ +public final class ServerKeyType extends ExpandableStringEnum { + /** Static value ServiceManaged for ServerKeyType. */ + public static final ServerKeyType SERVICE_MANAGED = fromString("ServiceManaged"); + + /** Static value AzureKeyVault for ServerKeyType. */ + public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates or finds a ServerKeyType from its string representation. + * @param name a name to look for + * @return the corresponding ServerKeyType + */ + @JsonCreator + public static ServerKeyType fromString(String name) { + return fromString(name, ServerKeyType.class); + } + + /** + * @return known ServerKeyType values + */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVersionCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVersionCapability.java new file mode 100644 index 0000000000000..0883d8b938f37 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVersionCapability.java @@ -0,0 +1,105 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The server capability. + */ +public class ServerVersionCapability { + /** + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported database editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /** + * The list of supported elastic pool editions. + */ + @JsonProperty(value = "supportedElasticPoolEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolEditions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported database editions. + * + * @return the supportedEditions value + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the list of supported elastic pool editions. + * + * @return the supportedElasticPoolEditions value + */ + public List supportedElasticPoolEditions() { + return this.supportedElasticPoolEditions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ServerVersionCapability object itself. + */ + public ServerVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..48a71aae2c025 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServerVulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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.v3_2017_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.VulnerabilityAssessmentScanRecordInner; +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.v3_2017_10.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ServerVulnerabilityAssessmentScanRecord. + */ +public interface ServerVulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServiceObjectiveCapability.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServiceObjectiveCapability.java new file mode 100644 index 0000000000000..b4197722662b1 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/ServiceObjectiveCapability.java @@ -0,0 +1,166 @@ +/** + * 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.v3_2017_10; + +import java.util.UUID; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The service objectives capability. + */ +public class ServiceObjectiveCapability { + /** + * The unique ID of the service objective. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private UUID id; + + /** + * The service objective name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported maximum database sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The performance level. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /** + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * The included (free) max size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the unique ID of the service objective. + * + * @return the id value + */ + public UUID id() { + return this.id; + } + + /** + * Get the service objective name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported maximum database sizes. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the performance level. + * + * @return the performanceLevel value + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the included (free) max size. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ServiceObjectiveCapability object itself. + */ + public ServiceObjectiveCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Sku.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Sku.java new file mode 100644 index 0000000000000..c961ebcc2bff7 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/Sku.java @@ -0,0 +1,152 @@ +/** + * 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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the 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 if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/TdeCertificates.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/TdeCertificates.java new file mode 100644 index 0000000000000..671e913d71470 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/TdeCertificates.java @@ -0,0 +1,31 @@ +/** + * 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.v3_2017_10; + +import rx.Completable; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.TdeCertificateInner; +import com.microsoft.azure.management.sql.v3_2017_10.implementation.TdeCertificatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TdeCertificates. + */ +public interface TdeCertificates extends HasInner { + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters); + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentPolicyBaselineName.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentPolicyBaselineName.java new file mode 100644 index 0000000000000..f7ae0a9c19673 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentPolicyBaselineName.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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for VulnerabilityAssessmentPolicyBaselineName. + */ +public enum VulnerabilityAssessmentPolicyBaselineName { + /** Enum value master. */ + MASTER("master"), + + /** Enum value default. */ + DEFAULT("default"); + + /** The actual serialized value for a VulnerabilityAssessmentPolicyBaselineName instance. */ + private String value; + + VulnerabilityAssessmentPolicyBaselineName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a VulnerabilityAssessmentPolicyBaselineName instance. + * + * @param value the serialized value to parse. + * @return the parsed VulnerabilityAssessmentPolicyBaselineName object, or null if unable to parse. + */ + @JsonCreator + public static VulnerabilityAssessmentPolicyBaselineName fromString(String value) { + VulnerabilityAssessmentPolicyBaselineName[] items = VulnerabilityAssessmentPolicyBaselineName.values(); + for (VulnerabilityAssessmentPolicyBaselineName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentRecurringScansProperties.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..719c366cb2744 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,98 @@ +/** + * 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.v3_2017_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get recurring scans state. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set recurring scans state. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanError.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanError.java new file mode 100644 index 0000000000000..291bc3c0f7a66 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanError.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.v3_2017_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a vulnerability assessment scan error. + */ +public class VulnerabilityAssessmentScanError { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanState.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanState.java new file mode 100644 index 0000000000000..73e11ab8f493d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanState.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanState. + */ +public final class VulnerabilityAssessmentScanState extends ExpandableStringEnum { + /** Static value Passed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState PASSED = fromString("Passed"); + + /** Static value Failed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED = fromString("Failed"); + + /** Static value FailedToRun for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED_TO_RUN = fromString("FailedToRun"); + + /** Static value InProgress for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState IN_PROGRESS = fromString("InProgress"); + + /** + * Creates or finds a VulnerabilityAssessmentScanState from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanState + */ + @JsonCreator + public static VulnerabilityAssessmentScanState fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanState.class); + } + + /** + * @return known VulnerabilityAssessmentScanState values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanState.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanTriggerType.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanTriggerType.java new file mode 100644 index 0000000000000..f26eab9be47c9 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/VulnerabilityAssessmentScanTriggerType.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.v3_2017_10; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanTriggerType. + */ +public final class VulnerabilityAssessmentScanTriggerType extends ExpandableStringEnum { + /** Static value OnDemand for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType ON_DEMAND = fromString("OnDemand"); + + /** Static value Recurring for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType RECURRING = fromString("Recurring"); + + /** + * Creates or finds a VulnerabilityAssessmentScanTriggerType from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanTriggerType + */ + @JsonCreator + public static VulnerabilityAssessmentScanTriggerType fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanTriggerType.class); + } + + /** + * @return known VulnerabilityAssessmentScanTriggerType values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanTriggerType.class); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..ee8f7b58b136b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicy; + +class BackupShortTermRetentionPoliciesImpl extends WrapperImpl implements BackupShortTermRetentionPolicies { + private final SqlManager manager; + + BackupShortTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().backupShortTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public BackupShortTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private BackupShortTermRetentionPolicyImpl wrapModel(BackupShortTermRetentionPolicyInner inner) { + return new BackupShortTermRetentionPolicyImpl(inner, manager()); + } + + private BackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new BackupShortTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + BackupShortTermRetentionPoliciesInner 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 BackupShortTermRetentionPolicy call(BackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + BackupShortTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupShortTermRetentionPolicy call(BackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..03fdad5bae106 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPoliciesInner.java @@ -0,0 +1,1135 @@ +/** + * 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.v3_2017_10.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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 BackupShortTermRetentionPolicies. + */ +public class BackupShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private BackupShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackupShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(BackupShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BackupShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface BackupShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v3_2017_10.BackupShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies") + 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.v3_2017_10.BackupShortTermRetentionPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner 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 policyName = "default"; + return service.get(resourceGroupName, serverName, 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); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, 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 = 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); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 updateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @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 beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(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 policyName = "default"; + final Integer retentionDays = null; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, serverName, databaseName, policyName, 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 a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, serverName, databaseName, policyName, 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 database's short 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 serverName The name of the server. + * @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<BackupShortTermRetentionPolicyInner> 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 database's short 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 serverName The name of the server. + * @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 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 database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackupShortTermRetentionPolicyInner> 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 database's short 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackupShortTermRetentionPolicyInner> 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 database's short 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BackupShortTermRetentionPolicyInner> 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 database's short 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<BackupShortTermRetentionPolicyInner> 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 short 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 short 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<BackupShortTermRetentionPolicyInner> 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 short 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<BackupShortTermRetentionPolicyInner> 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 short 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<BackupShortTermRetentionPolicyInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..2686bf20510c3 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class BackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements BackupShortTermRetentionPolicy, BackupShortTermRetentionPolicy.Definition, BackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + BackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new BackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + BackupShortTermRetentionPolicyImpl(BackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @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 Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BackupShortTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..489a765cc1685 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/BackupShortTermRetentionPolicyInner.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.v3_2017_10.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A short term retention policy. + */ +@JsonFlatten +public class BackupShortTermRetentionPolicyInner extends ProxyResource { + /** + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @param retentionDays the retentionDays value to set + * @return the BackupShortTermRetentionPolicyInner object itself. + */ + public BackupShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..38d3b64bbb662 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.Capabilities; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.LocationCapabilities; + +class CapabilitiesImpl extends WrapperImpl implements Capabilities { + private final SqlManager manager; + + CapabilitiesImpl(SqlManager manager) { + super(manager.inner().capabilities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByLocationAsync(String locationName) { + CapabilitiesInner client = this.inner(); + return client.listByLocationAsync(locationName) + .map(new Func1() { + @Override + public LocationCapabilities call(LocationCapabilitiesInner inner) { + return new LocationCapabilitiesImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesInner.java new file mode 100644 index 0000000000000..84bd9aa4b7449 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/CapabilitiesInner.java @@ -0,0 +1,217 @@ +/** + * 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.v3_2017_10.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2017_10.CapabilityGroup; +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 Capabilities. + */ +public class CapabilitiesInner { + /** The Retrofit service to perform REST calls. */ + private CapabilitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of CapabilitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CapabilitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(CapabilitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Capabilities to be + * used by Retrofit to perform actually REST calls. + */ + interface CapabilitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.Capabilities listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities") + Observable> listByLocation(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("include") CapabilityGroup include, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are 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 LocationCapabilitiesInner object if successful. + */ + public LocationCapabilitiesInner listByLocation(String locationName) { + return listByLocationWithServiceResponseAsync(locationName).toBlocking().single().body(); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are 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 listByLocationAsync(String locationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(locationName), serviceCallback); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable listByLocationAsync(String locationName) { + return listByLocationWithServiceResponseAsync(locationName).map(new Func1, LocationCapabilitiesInner>() { + @Override + public LocationCapabilitiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable> listByLocationWithServiceResponseAsync(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 CapabilityGroup include = null; + return service.listByLocation(locationName, this.client.subscriptionId(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @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 LocationCapabilitiesInner object if successful. + */ + public LocationCapabilitiesInner listByLocation(String locationName, CapabilityGroup include) { + return listByLocationWithServiceResponseAsync(locationName, include).toBlocking().single().body(); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @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(String locationName, CapabilityGroup include, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(locationName, include), serviceCallback); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable listByLocationAsync(String locationName, CapabilityGroup include) { + return listByLocationWithServiceResponseAsync(locationName, include).map(new Func1, LocationCapabilitiesInner>() { + @Override + public LocationCapabilitiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable> listByLocationWithServiceResponseAsync(String locationName, CapabilityGroup include) { + 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(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByLocationDelegate(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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..9016e49ab1779 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseImpl.java @@ -0,0 +1,467 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.Database; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseUpdate; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2017_10.Sku; +import com.microsoft.azure.management.sql.v3_2017_10.CreateMode; +import com.microsoft.azure.management.sql.v3_2017_10.SampleName; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseStatus; +import com.microsoft.azure.management.sql.v3_2017_10.CatalogCollationType; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseLicenseType; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseReadScale; +import rx.functions.Func1; + +class DatabaseImpl extends CreatableUpdatableImpl implements Database, Database.Definition, Database.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private DatabaseUpdate updateParameter; + + DatabaseImpl(String name, SqlManager manager) { + super(name, new DatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new DatabaseUpdate(); + } + + DatabaseImpl(DatabaseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public CatalogCollationType catalogCollation() { + return this.inner().catalogCollation(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public CreateMode createMode() { + return this.inner().createMode(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String currentServiceObjectiveName() { + return this.inner().currentServiceObjectiveName(); + } + + @Override + public Sku currentSku() { + return this.inner().currentSku(); + } + + @Override + public UUID databaseId() { + return this.inner().databaseId(); + } + + @Override + public String defaultSecondaryLocation() { + return this.inner().defaultSecondaryLocation(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String elasticPoolId() { + return this.inner().elasticPoolId(); + } + + @Override + public String failoverGroupId() { + return this.inner().failoverGroupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DatabaseLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String longTermRetentionBackupResourceId() { + return this.inner().longTermRetentionBackupResourceId(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public Long maxLogSizeBytes() { + return this.inner().maxLogSizeBytes(); + } + + @Override + public Long maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DatabaseReadScale readScale() { + return this.inner().readScale(); + } + + @Override + public String recoverableDatabaseId() { + return this.inner().recoverableDatabaseId(); + } + + @Override + public String recoveryServicesRecoveryPointId() { + return this.inner().recoveryServicesRecoveryPointId(); + } + + @Override + public String requestedServiceObjectiveName() { + return this.inner().requestedServiceObjectiveName(); + } + + @Override + public String restorableDroppedDatabaseId() { + return this.inner().restorableDroppedDatabaseId(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public SampleName sampleName() { + return this.inner().sampleName(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public DateTime sourceDatabaseDeletionDate() { + return this.inner().sourceDatabaseDeletionDate(); + } + + @Override + public String sourceDatabaseId() { + return this.inner().sourceDatabaseId(); + } + + @Override + public DatabaseStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public DatabaseImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + if (isInCreateMode()) { + this.inner().withCatalogCollation(catalogCollation); + } else { + this.updateParameter.withCatalogCollation(catalogCollation); + } + return this; + } + + @Override + public DatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public DatabaseImpl withCreateMode(CreateMode createMode) { + if (isInCreateMode()) { + this.inner().withCreateMode(createMode); + } else { + this.updateParameter.withCreateMode(createMode); + } + return this; + } + + @Override + public DatabaseImpl withElasticPoolId(String elasticPoolId) { + if (isInCreateMode()) { + this.inner().withElasticPoolId(elasticPoolId); + } else { + this.updateParameter.withElasticPoolId(elasticPoolId); + } + return this; + } + + @Override + public DatabaseImpl withLicenseType(DatabaseLicenseType licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public DatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (isInCreateMode()) { + this.inner().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } else { + this.updateParameter.withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } + return this; + } + + @Override + public DatabaseImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public DatabaseImpl withReadScale(DatabaseReadScale readScale) { + if (isInCreateMode()) { + this.inner().withReadScale(readScale); + } else { + this.updateParameter.withReadScale(readScale); + } + return this; + } + + @Override + public DatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.inner().withRecoverableDatabaseId(recoverableDatabaseId); + } else { + this.updateParameter.withRecoverableDatabaseId(recoverableDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + if (isInCreateMode()) { + this.inner().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } else { + this.updateParameter.withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } + return this; + } + + @Override + public DatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.inner().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } else { + this.updateParameter.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public DatabaseImpl withSampleName(SampleName sampleName) { + if (isInCreateMode()) { + this.inner().withSampleName(sampleName); + } else { + this.updateParameter.withSampleName(sampleName); + } + return this; + } + + @Override + public DatabaseImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } else { + this.updateParameter.withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + } else { + this.updateParameter.withSourceDatabaseId(sourceDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseInner.java new file mode 100644 index 0000000000000..bcd093a3eacf3 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseInner.java @@ -0,0 +1,723 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.Sku; +import com.microsoft.azure.management.sql.v3_2017_10.CreateMode; +import com.microsoft.azure.management.sql.v3_2017_10.SampleName; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseStatus; +import java.util.UUID; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_10.CatalogCollationType; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseLicenseType; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseReadScale; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Kind of database. This is metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource that manages the database. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * 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; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this database. Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /** + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource that manages the database. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @param createMode the createMode value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + 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 DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the max log size for this database. + * + * @return the maxLogSizeBytes value + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the name and tier of the SKU. + * + * @return the currentSku value + */ + public Sku currentSku() { + return this.currentSku; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationImpl.java new file mode 100644 index 0000000000000..10e700024ddbd --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationImpl.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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_10.ManagementOperationState; + +class DatabaseOperationImpl extends WrapperImpl implements DatabaseOperation { + private final SqlManager manager; + + DatabaseOperationImpl(DatabaseOperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @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 name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationInner.java new file mode 100644 index 0000000000000..3aeb656737cd7 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationInner.java @@ -0,0 +1,233 @@ +/** + * 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.v3_2017_10.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_10.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database operation. + */ +@JsonFlatten +public class DatabaseOperationInner extends ProxyResource { + /** + * The name of the database the operation is being performed on. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * 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 name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * 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; + + /** + * Get the name of the database the operation is being performed on. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * 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 name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * 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; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsImpl.java new file mode 100644 index 0000000000000..1421b3a0401ae --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseOperation; + +class DatabaseOperationsImpl extends WrapperImpl implements DatabaseOperations { + private final SqlManager manager; + + DatabaseOperationsImpl(SqlManager manager) { + super(manager.inner().databaseOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabaseOperationImpl wrapModel(DatabaseOperationInner inner) { + return new DatabaseOperationImpl(inner, manager()); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + DatabaseOperationsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, databaseName, operationId).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseOperationsInner 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 DatabaseOperation call(DatabaseOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsInner.java new file mode 100644 index 0000000000000..9e3b0d6d60e5a --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseOperationsInner.java @@ -0,0 +1,417 @@ +/** + * 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.v3_2017_10.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.POST; +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 DatabaseOperations. + */ +public class DatabaseOperationsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.DatabaseOperations cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @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.v3_2017_10.DatabaseOperations listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations") + 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.v3_2017_10.DatabaseOperations listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).toBlocking().single().body(); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @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 cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId), serviceCallback); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the asynchronous operation on the 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. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + 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 (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.cancel(resourceGroupName, serverName, databaseName, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 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. + * @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<DatabaseOperationInner> 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 operations performed on the 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. + * @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 operations performed on the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseOperationInner> 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 operations performed on the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseOperationInner> 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 operations performed on the 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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); + } + + /** + * Gets a list of operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..fb1faa42fea0b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -0,0 +1,140 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentRecurringScansProperties; + +class DatabaseVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessment, DatabaseVulnerabilityAssessment.Definition, DatabaseVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + DatabaseVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseVulnerabilityAssessmentImpl(DatabaseVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + 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 name() { + return this.inner().name(); + } + + @Override + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..9e0f993f8bd7d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentInner.java @@ -0,0 +1,132 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). It is required if + * server level vulnerability assessment policy doesn't set. + */ + @JsonProperty(value = "properties.storageContainerPath") + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..11309aa3ab60e --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,120 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentPolicyBaselineName; + +class DatabaseVulnerabilityAssessmentRuleBaselineImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessmentRuleBaseline, DatabaseVulnerabilityAssessmentRuleBaseline.Definition, DatabaseVulnerabilityAssessmentRuleBaseline.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private String ruleId; + private VulnerabilityAssessmentPolicyBaselineName baselineName; + private List cbaselineResults; + private List ubaselineResults; + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentRuleBaselineInner()); + this.manager = manager; + // Set resource name + this.baselineName = name; + // + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(DatabaseVulnerabilityAssessmentRuleBaselineInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.baselineName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.ruleId = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + this.baselineName = IdParsingUtils.getValueFromIdByName(inner.id(), "baselines"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName, this.cbaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName, this.ubaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List baselineResults() { + return this.inner().baselineResults(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withExistingRule(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + this.ruleId = ruleId; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withBaselineResults(List baselineResults) { + if (isInCreateMode()) { + this.cbaselineResults = baselineResults; + } else { + this.ubaselineResults = baselineResults; + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..d011bb062686d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java @@ -0,0 +1,48 @@ +/** + * 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.v3_2017_10.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment rule baseline. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /** + * The rule baseline result. + */ + @JsonProperty(value = "properties.baselineResults", required = true) + private List baselineResults; + + /** + * Get the rule baseline result. + * + * @return the baselineResults value + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the rule baseline result. + * + * @param baselineResults the baselineResults value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults(List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java new file mode 100644 index 0000000000000..93ca7d456ebc6 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java @@ -0,0 +1,46 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentScansExport; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DatabaseVulnerabilityAssessmentScansExportImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentScansExport { + private final SqlManager manager; + DatabaseVulnerabilityAssessmentScansExportImpl(DatabaseVulnerabilityAssessmentScansExportInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String exportedReportLocation() { + return this.inner().exportedReportLocation(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java new file mode 100644 index 0000000000000..969f24ca817c0 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java @@ -0,0 +1,36 @@ +/** + * 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.v3_2017_10.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database Vulnerability Assessment scan export resource. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentScansExportInner extends ProxyResource { + /** + * Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + @JsonProperty(value = "properties.exportedReportLocation", access = JsonProperty.Access.WRITE_ONLY) + private String exportedReportLocation; + + /** + * Get location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + * + * @return the exportedReportLocation value + */ + public String exportedReportLocation() { + return this.exportedReportLocation; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..c8478bef5b752 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,94 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentScans; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_10.ServerVulnerabilityAssessmentScanRecord; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentScansExport; + +class DatabaseVulnerabilityAssessmentScansImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentScans { + private final SqlManager manager; + + DatabaseVulnerabilityAssessmentScansImpl(SqlManager manager) { + super(manager.inner().databaseVulnerabilityAssessmentScans()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServerVulnerabilityAssessmentScanRecordImpl wrapServerVulnerabilityAssessmentScanRecordModel(VulnerabilityAssessmentScanRecordInner inner) { + return new ServerVulnerabilityAssessmentScanRecordImpl(inner, manager()); + } + + private Observable getVulnerabilityAssessmentScanRecordInnerUsingDatabaseVulnerabilityAssessmentScansInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String scanId = IdParsingUtils.getValueFromIdByName(id, "scans"); + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, scanId); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, scanId) + .map(new Func1() { + @Override + public ServerVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapServerVulnerabilityAssessmentScanRecordModel(inner); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseVulnerabilityAssessmentScansInner 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 ServerVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapServerVulnerabilityAssessmentScanRecordModel(inner); + } + }); + } + + @Override + public Completable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.initiateScanAsync(resourceGroupName, serverName, databaseName, scanId).toCompletable(); + } + + @Override + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.exportAsync(resourceGroupName, serverName, databaseName, scanId) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentScansExport call(DatabaseVulnerabilityAssessmentScansExportInner inner) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansInner.java new file mode 100644 index 0000000000000..dab2c6a66db20 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabaseVulnerabilityAssessmentScansInner.java @@ -0,0 +1,717 @@ +/** + * 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.v3_2017_10.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 okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 DatabaseVulnerabilityAssessmentScans. + */ +public class DatabaseVulnerabilityAssessmentScansInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentScansService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentScansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentScansService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessmentScans to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2017_10.DatabaseVulnerabilityAssessmentScans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.DatabaseVulnerabilityAssessmentScans initiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> initiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.DatabaseVulnerabilityAssessmentScans beginInitiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> beginInitiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.DatabaseVulnerabilityAssessmentScans export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.DatabaseVulnerabilityAssessmentScans listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the vulnerability assessment scans of 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. + * @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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of 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. + * @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); + } + + /** + * Lists the vulnerability assessment scans of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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 vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 VulnerabilityAssessmentScanRecordInner object if successful. + */ + public VulnerabilityAssessmentScanRecordInner get(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, VulnerabilityAssessmentScanRecordInner>() { + @Override + public VulnerabilityAssessmentScanRecordInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan(String resourceGroupName, String serverName, String databaseName, String scanId) { + initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().last().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> initiateScanWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + Observable> observable = service.initiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScan(String resourceGroupName, String serverName, String databaseName, String scanId) { + beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginInitiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginInitiateScanWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.beginInitiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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 = beginInitiateScanDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginInitiateScanDelegate(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); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 DatabaseVulnerabilityAssessmentScansExportInner object if successful. + */ + public DatabaseVulnerabilityAssessmentScansExportInner export(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, DatabaseVulnerabilityAssessmentScansExportInner>() { + @Override + public DatabaseVulnerabilityAssessmentScansExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.export(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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 = exportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDelegate(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); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..85c97e8c974fd --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesImpl.java @@ -0,0 +1,135 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.Databases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_10.Database; + +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 DatabaseImpl define(String name) { + return wrapModel(name); + } + + private DatabaseImpl wrapModel(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + + private DatabaseImpl wrapModel(String name) { + return new DatabaseImpl(name, this.manager()); + } + + @Override + public Completable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.pauseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.resumeAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + DatabasesInner client = this.inner(); + return client.renameAsync(resourceGroupName, serverName, databaseName, id).toCompletable(); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + DatabasesInner 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 Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..af8fb455f2f98 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/DatabasesInner.java @@ -0,0 +1,1862 @@ +/** + * 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.v3_2017_10.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.v3_2017_10.DatabaseUpdate; +import com.microsoft.azure.management.sql.v3_2017_10.ResourceMoveDefinition; +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 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.v3_2017_10.Databases upgradeDataWarehouse" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + Observable> upgradeDataWarehouse(@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.v3_2017_10.Databases beginUpgradeDataWarehouse" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + Observable> beginUpgradeDataWarehouse(@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.v3_2017_10.Databases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases") + 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.v3_2017_10.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> get(@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.v3_2017_10.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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.v3_2017_10.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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.v3_2017_10.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v3_2017_10.Databases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v3_2017_10.Databases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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.v3_2017_10.Databases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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.v3_2017_10.Databases listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases") + Observable> listByElasticPool(@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.v3_2017_10.Databases pause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> pause(@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.v3_2017_10.Databases beginPause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> beginPause(@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.v3_2017_10.Databases resume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> resume(@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.v3_2017_10.Databases beginResume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> beginResume(@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.v3_2017_10.Databases rename" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move") + Observable> rename(@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, @Body ResourceMoveDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.Databases listByServerNext" }) + @GET + Observable> listByServerNext(@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.v3_2017_10.Databases listByElasticPoolNext" }) + @GET + Observable> listByElasticPoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> upgradeDataWarehouseWithServiceResponseAsync(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."); + } + Observable> observable = service.upgradeDataWarehouse(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 beginUpgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @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 beginUpgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUpgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUpgradeDataWarehouseWithServiceResponseAsync(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."); + } + return service.beginUpgradeDataWarehouse(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 clientResponse = beginUpgradeDataWarehouseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpgradeDataWarehouseDelegate(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 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 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<DatabaseInner> 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 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 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> 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 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. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets 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. + * @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. + * + * @param resourceGroupName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner 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."); + } + return service.get(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 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner 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); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner 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); + return service.beginCreateOrUpdate(resourceGroupName, serverName, 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 the 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. + * @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 databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes the 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. + * @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 databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(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."); + } + Observable> observable = service.delete(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the 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. + * @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 databaseName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes the 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. + * @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 databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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."); + } + return service.beginDelete(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 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate 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); + Observable> observable = service.update(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner 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 serverName The name of the server. + * @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 DatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate 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); + return service.beginUpdate(resourceGroupName, serverName, 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); + } + + /** + * Gets a list of databases in 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. + * @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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPool(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ServiceResponse> response = listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in 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. + * @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> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName) + .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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic 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 serverName The name of the server. + ServiceResponse> * @param elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolSinglePageAsync(final String resourceGroupName, final String serverName, final 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.listByElasticPool(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> result = listByElasticPoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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); + } + + /** + * Pauses 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 be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Pauses 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 be paused. + * @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 pauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> pauseWithServiceResponseAsync(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."); + } + Observable> observable = service.pause(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Pauses 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 be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginPause(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Pauses 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 be paused. + * @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 beginPauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginPauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginPauseWithServiceResponseAsync(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."); + } + return service.beginPause(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 clientResponse = beginPauseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPauseDelegate(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); + } + + /** + * Resumes 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 be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Resumes 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 be resumed. + * @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 resumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resumeWithServiceResponseAsync(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."); + } + Observable> observable = service.resume(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Resumes 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 be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginResume(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Resumes 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 be resumed. + * @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 beginResumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginResumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginResumeWithServiceResponseAsync(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."); + } + return service.beginResume(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 clientResponse = beginResumeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResumeDelegate(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); + } + + /** + * Renames 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 rename. + * @param id The target ID for the 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 + */ + public void rename(String resourceGroupName, String serverName, String databaseName, String id) { + renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).toBlocking().single().body(); + } + + /** + * Renames 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 rename. + * @param id The target ID for the 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 renameAsync(String resourceGroupName, String serverName, String databaseName, String id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id), serviceCallback); + } + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Renames 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 rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> renameWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String id) { + 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."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + ResourceMoveDefinition parameters = new ResourceMoveDefinition(); + parameters.withId(id); + return service.rename(resourceGroupName, serverName, 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 = renameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse renameDelegate(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 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<DatabaseInner> 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 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> 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 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<DatabaseInner> 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 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<DatabaseInner> 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 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<DatabaseInner> 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); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPoolNext(final String nextPageLink) { + ServiceResponse> response = listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in an elastic 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> listByElasticPoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object + */ + public Observable> listByElasticPoolNextAsync(final String nextPageLink) { + return listByElasticPoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object + */ + public Observable>> listByElasticPoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic 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<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolNextDelegate(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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolImpl.java new file mode 100644 index 0000000000000..b72653743b361 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolImpl.java @@ -0,0 +1,238 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPool; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolUpdate; +import java.util.Map; +import com.microsoft.azure.management.sql.v3_2017_10.Sku; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolPerDatabaseSettings; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolLicenseType; +import rx.functions.Func1; + +class ElasticPoolImpl extends CreatableUpdatableImpl implements ElasticPool, ElasticPool.Definition, ElasticPool.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String elasticPoolName; + private ElasticPoolUpdate updateParameter; + + ElasticPoolImpl(String name, SqlManager manager) { + super(name, new ElasticPoolInner()); + this.manager = manager; + // Set resource name + this.elasticPoolName = name; + // + this.updateParameter = new ElasticPoolUpdate(); + } + + ElasticPoolImpl(ElasticPoolInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.elasticPoolName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.elasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "elasticPools"); + // + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.inner()) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.updateParameter) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.elasticPoolName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public ElasticPoolLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Long maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.inner().perDatabaseSettings(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public ElasticPoolState state() { + return this.inner().state(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public ElasticPoolImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ElasticPoolImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ElasticPoolImpl withLicenseType(ElasticPoolLicenseType licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public ElasticPoolImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public ElasticPoolImpl withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + if (isInCreateMode()) { + this.inner().withPerDatabaseSettings(perDatabaseSettings); + } else { + this.updateParameter.withPerDatabaseSettings(perDatabaseSettings); + } + return this; + } + + @Override + public ElasticPoolImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public ElasticPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public ElasticPoolImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolInner.java new file mode 100644 index 0000000000000..3a6d1b83af7de --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolInner.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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.Sku; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolPerDatabaseSettings; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolLicenseType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An elastic pool. + */ +@JsonFlatten +public class ElasticPoolInner extends Resource { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Kind of elastic pool. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The state of the elastic pool. Possible values include: 'Creating', + * 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /** + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /** + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this elastic pool. Possible values + * include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled'. + * + * @return the state value + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the per database settings for the elastic pool. + * + * @return the perDatabaseSettings value + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationImpl.java new file mode 100644 index 0000000000000..3ce901b9fec5a --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationImpl.java @@ -0,0 +1,116 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ElasticPoolOperationImpl extends WrapperImpl implements ElasticPoolOperation { + private final SqlManager manager; + + ElasticPoolOperationImpl(ElasticPoolOperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @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 name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationInner.java new file mode 100644 index 0000000000000..394fef7e9380e --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationInner.java @@ -0,0 +1,231 @@ +/** + * 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.v3_2017_10.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A elastic pool operation. + */ +@JsonFlatten +public class ElasticPoolOperationInner extends ProxyResource { + /** + * The name of the elastic pool the operation is being performed on. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * 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 name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The operation state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String 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; + + /** + * Get the name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * 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 name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the operation start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the operation state. + * + * @return the state value + */ + public String 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; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsImpl.java new file mode 100644 index 0000000000000..30534794f1b8a --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolOperation; + +class ElasticPoolOperationsImpl extends WrapperImpl implements ElasticPoolOperations { + private final SqlManager manager; + + ElasticPoolOperationsImpl(SqlManager manager) { + super(manager.inner().elasticPoolOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ElasticPoolOperationImpl wrapModel(ElasticPoolOperationInner inner) { + return new ElasticPoolOperationImpl(inner, manager()); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + ElasticPoolOperationsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, elasticPoolName, operationId).toCompletable(); + } + + @Override + public Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ElasticPoolOperationsInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ElasticPoolOperation call(ElasticPoolOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsInner.java new file mode 100644 index 0000000000000..6d54f70d8e9c2 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolOperationsInner.java @@ -0,0 +1,417 @@ +/** + * 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.v3_2017_10.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.POST; +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 ElasticPoolOperations. + */ +public class ElasticPoolOperationsInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolOperations cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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.v3_2017_10.ElasticPoolOperations listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations") + Observable> listByElasticPool(@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.v3_2017_10.ElasticPoolOperations listByElasticPoolNext" }) + @GET + Observable> listByElasticPoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId).toBlocking().single().body(); + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @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 cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId), serviceCallback); + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the asynchronous operation on the 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 String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + 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 (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.cancel(resourceGroupName, serverName, elasticPoolName, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 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 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 + * @return the PagedList<ElasticPoolOperationInner> object if successful. + */ + public PagedList listByElasticPool(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ServiceResponse> response = listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the 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 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> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the 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 String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolOperationInner> object + */ + public Observable> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the 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 String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolOperationInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName) + .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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the elastic 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 serverName The name of the server. + ServiceResponse> * @param elasticPoolName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolSinglePageAsync(final String resourceGroupName, final String serverName, final 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.listByElasticPool(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> result = listByElasticPoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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 operations performed on the elastic 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<ElasticPoolOperationInner> object if successful. + */ + public PagedList listByElasticPoolNext(final String nextPageLink) { + ServiceResponse> response = listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the elastic 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> listByElasticPoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the elastic 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<ElasticPoolOperationInner> object + */ + public Observable> listByElasticPoolNextAsync(final String nextPageLink) { + return listByElasticPoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the elastic 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<ElasticPoolOperationInner> object + */ + public Observable>> listByElasticPoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the elastic 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<ElasticPoolOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolNextDelegate(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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..54df7d62cfcfd --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPools; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPool; + +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 ElasticPoolImpl define(String name) { + return wrapModel(name); + } + + private ElasticPoolImpl wrapModel(ElasticPoolInner inner) { + return new ElasticPoolImpl(inner, manager()); + } + + private ElasticPoolImpl wrapModel(String name) { + return new ElasticPoolImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ElasticPoolsInner 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 ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1() { + @Override + public ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, elasticPoolName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsInner.java new file mode 100644 index 0000000000000..2d4257d21d8d3 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ElasticPoolsInner.java @@ -0,0 +1,1095 @@ +/** + * 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.v3_2017_10.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.v3_2017_10.ElasticPoolUpdate; +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 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.v3_2017_10.ElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools") + Observable> listByServer(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Query("$skip") Integer skip, @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.v3_2017_10.ElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> get(@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.v3_2017_10.ElasticPools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolInner 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.v3_2017_10.ElasticPools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolInner 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.v3_2017_10.ElasticPools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> delete(@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.v3_2017_10.ElasticPools beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v3_2017_10.ElasticPools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate 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.v3_2017_10.ElasticPools beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate 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.v3_2017_10.ElasticPools listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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 PagedList<ElasticPoolInner> 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."); + } + final Integer skip = null; + return service.listByServer(resourceGroupName, serverName, this.client.subscriptionId(), skip, 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); + } + } + }); + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @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<ElasticPoolInner> object if successful. + */ + public PagedList listByServer(final String resourceGroupName, final String serverName, final Integer skip) { + ServiceResponse> response = listByServerSinglePageAsync(resourceGroupName, serverName, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @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 Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(resourceGroupName, serverName, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> object + */ + public Observable> listByServerAsync(final String resourceGroupName, final String serverName, final Integer skip) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all elastic pools in 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 skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName, final Integer skip) { + return listByServerSinglePageAsync(resourceGroupName, serverName, skip) + .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 elastic pools in 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. + ServiceResponse> * @param skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName, final Integer skip) { + 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(), skip, 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 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. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Gets 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. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(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.get(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 = 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 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. + * @param parameters The elastic pool parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner createOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @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 elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (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 (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, elasticPoolName, 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 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. + * @param parameters The elastic pool parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @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 elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates 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. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (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 (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, elasticPoolName, 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 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. + * @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 elasticPoolName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().last().body(); + } + + /** + * Deletes 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. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(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.delete(resourceGroupName, serverName, elasticPoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes 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. + * @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 elasticPoolName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Deletes 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. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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 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. + * @param parameters The elastic pool update parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner update(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @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 serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (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 (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, serverName, elasticPoolName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @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 serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (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 (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, serverName, elasticPoolName, 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 all elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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<ElasticPoolInner> 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 elastic pools in 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<ElasticPoolInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/IdParsingUtils.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..8c271b010fbc7 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v3_2017_10.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupImpl.java new file mode 100644 index 0000000000000..8ccffad31581a --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupImpl.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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.PartnerRegionInfo; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstancePairInfo; + +class InstanceFailoverGroupImpl extends CreatableUpdatableImpl implements InstanceFailoverGroup, InstanceFailoverGroup.Definition, InstanceFailoverGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String locationName; + private String failoverGroupName; + + InstanceFailoverGroupImpl(String name, SqlManager manager) { + super(name, new InstanceFailoverGroupInner()); + this.manager = manager; + // Set resource name + this.failoverGroupName = name; + // + } + + InstanceFailoverGroupImpl(InstanceFailoverGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.failoverGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.failoverGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "instanceFailoverGroups"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.locationName, this.failoverGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.locationName, this.failoverGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.getAsync(this.resourceGroupName, this.locationName, this.failoverGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List managedInstancePairs() { + return this.inner().managedInstancePairs(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List partnerRegions() { + return this.inner().partnerRegions(); + } + + @Override + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.inner().readOnlyEndpoint(); + } + + @Override + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.inner().readWriteEndpoint(); + } + + @Override + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.inner().replicationRole(); + } + + @Override + public String replicationState() { + return this.inner().replicationState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public InstanceFailoverGroupImpl withExistingLocation(String resourceGroupName, String locationName) { + this.resourceGroupName = resourceGroupName; + this.locationName = locationName; + return this; + } + + @Override + public InstanceFailoverGroupImpl withManagedInstancePairs(List managedInstancePairs) { + this.inner().withManagedInstancePairs(managedInstancePairs); + return this; + } + + @Override + public InstanceFailoverGroupImpl withPartnerRegions(List partnerRegions) { + this.inner().withPartnerRegions(partnerRegions); + return this; + } + + @Override + public InstanceFailoverGroupImpl withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.inner().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + @Override + public InstanceFailoverGroupImpl withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.inner().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupInner.java new file mode 100644 index 0000000000000..bc7d3b845939a --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupInner.java @@ -0,0 +1,161 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.PartnerRegionInfo; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstancePairInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An instance failover group. + */ +@JsonFlatten +public class InstanceFailoverGroupInner extends ProxyResource { + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint", required = true) + private InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * Local replication role of the failover group instance. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /** + * Partner region information for the failover group. + */ + @JsonProperty(value = "properties.partnerRegions", required = true) + private List partnerRegions; + + /** + * List of managed instance pairs in the failover group. + */ + @JsonProperty(value = "properties.managedInstancePairs", required = true) + private List managedInstancePairs; + + /** + * Get read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get replication state of the failover group instance. + * + * @return the replicationState value + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get partner region information for the failover group. + * + * @return the partnerRegions value + */ + public List partnerRegions() { + return this.partnerRegions; + } + + /** + * Set partner region information for the failover group. + * + * @param partnerRegions the partnerRegions value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withPartnerRegions(List partnerRegions) { + this.partnerRegions = partnerRegions; + return this; + } + + /** + * Get list of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value + */ + public List managedInstancePairs() { + return this.managedInstancePairs; + } + + /** + * Set list of managed instance pairs in the failover group. + * + * @param managedInstancePairs the managedInstancePairs value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withManagedInstancePairs(List managedInstancePairs) { + this.managedInstancePairs = managedInstancePairs; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsImpl.java new file mode 100644 index 0000000000000..231b1f74e3b13 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsImpl.java @@ -0,0 +1,105 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroup; + +class InstanceFailoverGroupsImpl extends WrapperImpl implements InstanceFailoverGroups { + private final SqlManager manager; + + InstanceFailoverGroupsImpl(SqlManager manager) { + super(manager.inner().instanceFailoverGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public InstanceFailoverGroupImpl define(String name) { + return wrapModel(name); + } + + private InstanceFailoverGroupImpl wrapModel(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + + private InstanceFailoverGroupImpl wrapModel(String name) { + return new InstanceFailoverGroupImpl(name, this.manager()); + } + + @Override + public Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.forceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByLocationAsync(final String resourceGroupName, final String locationName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.listByLocationAsync(resourceGroupName, locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, locationName, failoverGroupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsInner.java new file mode 100644 index 0000000000000..faa1b0a8c7cc2 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/InstanceFailoverGroupsInner.java @@ -0,0 +1,1134 @@ +/** + * 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.v3_2017_10.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.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 InstanceFailoverGroups. + */ +public class InstanceFailoverGroupsInner { + /** The Retrofit service to perform REST calls. */ + private InstanceFailoverGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of InstanceFailoverGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstanceFailoverGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(InstanceFailoverGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InstanceFailoverGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface InstanceFailoverGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2017_10.InstanceFailoverGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner 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.v3_2017_10.InstanceFailoverGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner 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.v3_2017_10.InstanceFailoverGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2017_10.InstanceFailoverGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2017_10.InstanceFailoverGroups listByLocation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups") + Observable> listByLocation(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @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.v3_2017_10.InstanceFailoverGroups failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2017_10.InstanceFailoverGroups beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2017_10.InstanceFailoverGroups forceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> forceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2017_10.InstanceFailoverGroups beginForceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> beginForceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.v3_2017_10.InstanceFailoverGroups listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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 failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner createOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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 failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @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 locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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 failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover 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 locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @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<InstanceFailoverGroupInner> object if successful. + */ + public PagedList listByLocation(final String resourceGroupName, final String locationName) { + ServiceResponse> response = listByLocationSinglePageAsync(resourceGroupName, locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @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 resourceGroupName, final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(resourceGroupName, locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable> listByLocationAsync(final String resourceGroupName, final String locationName) { + return listByLocationWithServiceResponseAsync(resourceGroupName, locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName) { + return listByLocationSinglePageAsync(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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the failover groups in a 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 name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstanceFailoverGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(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."); + } + return service.listByLocation(resourceGroupName, locationName, 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 = 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); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner failover(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginFailover(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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, locationName, failoverGroupName, 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); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> forceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @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 beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The 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 name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginForceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + 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 (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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.beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, 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 = beginForceFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginForceFailoverAllowDataLossDelegate(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 the failover groups in a 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<InstanceFailoverGroupInner> 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 failover groups in a 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 failover groups in a 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<InstanceFailoverGroupInner> 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 failover groups in a 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<InstanceFailoverGroupInner> 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 failover groups in a 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<InstanceFailoverGroupInner> 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); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesImpl.java new file mode 100644 index 0000000000000..105df466e6e9d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesImpl.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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.LocationCapabilities; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.CapabilityStatus; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceVersionCapability; +import com.microsoft.azure.management.sql.v3_2017_10.ServerVersionCapability; + +class LocationCapabilitiesImpl extends WrapperImpl implements LocationCapabilities { + private final SqlManager manager; + LocationCapabilitiesImpl(LocationCapabilitiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reason() { + return this.inner().reason(); + } + + @Override + public CapabilityStatus status() { + return this.inner().status(); + } + + @Override + public List supportedManagedInstanceVersions() { + return this.inner().supportedManagedInstanceVersions(); + } + + @Override + public List supportedServerVersions() { + return this.inner().supportedServerVersions(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesInner.java new file mode 100644 index 0000000000000..4f3950293a1a3 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/LocationCapabilitiesInner.java @@ -0,0 +1,108 @@ +/** + * 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.v3_2017_10.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.ServerVersionCapability; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceVersionCapability; +import com.microsoft.azure.management.sql.v3_2017_10.CapabilityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The location capability. + */ +public class LocationCapabilitiesInner { + /** + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported server versions. + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerVersions; + + /** + * The list of supported managed instance versions. + */ + @JsonProperty(value = "supportedManagedInstanceVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedManagedInstanceVersions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the location name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported server versions. + * + * @return the supportedServerVersions value + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Get the list of supported managed instance versions. + * + * @return the supportedManagedInstanceVersions value + */ + public List supportedManagedInstanceVersions() { + return this.supportedManagedInstanceVersions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the LocationCapabilitiesInner object itself. + */ + public LocationCapabilitiesInner withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..84ba9f6d29a68 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,72 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentRuleBaseline; +import rx.Completable; + +class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessmentRuleBaselines()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl defineBaseline(String name) { + return wrapBaselineModel(name); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapBaselineModel(String name) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentRuleBaselineInnerUsingManagedDatabaseVulnerabilityAssessmentRuleBaselinesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String ruleId = IdParsingUtils.getValueFromIdByName(id, "rules"); + String baselineName = IdParsingUtils.getValueFromIdByName(id, "baselines"); + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaseline call(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java new file mode 100644 index 0000000000000..6faede49c2fb0 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java @@ -0,0 +1,408 @@ +/** + * 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.v3_2017_10.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentPolicyBaselineName; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ +public class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessmentRuleBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentRuleBaselines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentRuleBaselines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentRuleBaselines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner get(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults).toBlocking().single().body(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults), serviceCallback); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 (baselineResults == null) { + throw new IllegalArgumentException("Parameter baselineResults is required and cannot be null."); + } + Validator.validate(baselineResults); + final String vulnerabilityAssessmentName = "default"; + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + parameters.withBaselineResults(baselineResults); + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 = 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The 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 for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..756684a1b1eb0 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentScansExport; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceVulnerabilityAssessmentScanRecord; + +class ManagedDatabaseVulnerabilityAssessmentScansImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessmentScans { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentScansImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessmentScans()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ManagedInstanceVulnerabilityAssessmentScanRecordImpl wrapModel(VulnerabilityAssessmentScanRecordInner inner) { + return new ManagedInstanceVulnerabilityAssessmentScanRecordImpl(inner, manager()); + } + + @Override + public Completable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.initiateScanAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toCompletable(); + } + + @Override + public Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.exportAsync(resourceGroupName, managedInstanceName, databaseName, scanId) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentScansExport call(DatabaseVulnerabilityAssessmentScansExportInner inner) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseVulnerabilityAssessmentScansInner 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 ManagedInstanceVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, scanId) + .map(new Func1() { + @Override + public ManagedInstanceVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java new file mode 100644 index 0000000000000..0752e5f05ae4c --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java @@ -0,0 +1,717 @@ +/** + * 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.v3_2017_10.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 okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 ManagedDatabaseVulnerabilityAssessmentScans. + */ +public class ManagedDatabaseVulnerabilityAssessmentScansInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentScansService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentScansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentScansService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessmentScans to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans initiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> initiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans beginInitiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> beginInitiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of 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 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); + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.listByDatabase(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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 vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 VulnerabilityAssessmentScanRecordInner object if successful. + */ + public VulnerabilityAssessmentScanRecordInner get(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, VulnerabilityAssessmentScanRecordInner>() { + @Override + public VulnerabilityAssessmentScanRecordInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().last().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> initiateScanWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + Observable> observable = service.initiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginInitiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginInitiateScanWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.beginInitiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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 = beginInitiateScanDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginInitiateScanDelegate(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); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 DatabaseVulnerabilityAssessmentScansExportInner object if successful. + */ + public DatabaseVulnerabilityAssessmentScansExportInner export(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, DatabaseVulnerabilityAssessmentScansExportInner>() { + @Override + public DatabaseVulnerabilityAssessmentScansExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.export(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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 = exportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDelegate(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); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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 the vulnerability assessment scans of a 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<VulnerabilityAssessmentScanRecordInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..f9a155beae9e8 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessment; +import com.microsoft.azure.Page; +import rx.Completable; + +class ManagedDatabaseVulnerabilityAssessmentsImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessments { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl defineVulnerabilityAssessment(String name) { + return wrapVulnerabilityAssessmentModel(name); + } + + private DatabaseVulnerabilityAssessmentImpl wrapVulnerabilityAssessmentModel(String name) { + return new DatabaseVulnerabilityAssessmentImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentImpl wrapDatabaseVulnerabilityAssessmentModel(DatabaseVulnerabilityAssessmentInner inner) { + return new DatabaseVulnerabilityAssessmentImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentInnerUsingManagedDatabaseVulnerabilityAssessmentsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapDatabaseVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner 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 DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapDatabaseVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..4f459865e8127 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java @@ -0,0 +1,618 @@ +/** + * 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.v3_2017_10.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 ManagedDatabaseVulnerabilityAssessments. + */ +public class ManagedDatabaseVulnerabilityAssessmentsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body DatabaseVulnerabilityAssessmentInner 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.v3_2017_10.ManagedDatabaseVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2017_10.ManagedDatabaseVulnerabilityAssessments listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments") + 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.v3_2017_10.ManagedDatabaseVulnerabilityAssessments listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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 database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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, DatabaseVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String managedInstanceName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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(); + } + }); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment 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<DatabaseVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment 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 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); + } + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessments of 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessments of 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 managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseVulnerabilityAssessmentInner> 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); + } + + /** + * Lists the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessments of 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 the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> 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 the vulnerability assessments of 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<DatabaseVulnerabilityAssessmentInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorImpl.java new file mode 100644 index 0000000000000..eab62a66a597b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorImpl.java @@ -0,0 +1,67 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceEncryptionProtector; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ServerKeyType; + +class ManagedInstanceEncryptionProtectorImpl extends WrapperImpl implements ManagedInstanceEncryptionProtector { + private final SqlManager manager; + ManagedInstanceEncryptionProtectorImpl(ManagedInstanceEncryptionProtectorInner 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 kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serverKeyName() { + return this.inner().serverKeyName(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorInner.java new file mode 100644 index 0000000000000..ec48d0e841f34 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorInner.java @@ -0,0 +1,120 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The managed instance encryption protector. + */ +@JsonFlatten +public class ManagedInstanceEncryptionProtectorInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The name of the managed instance key. + */ + @JsonProperty(value = "properties.serverKeyName") + private String serverKeyName; + + /** + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * Possible values include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the server key. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * Thumbprint of the server key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the name of the managed instance key. + * + * @return the serverKeyName value + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the name of the managed instance key. + * + * @param serverKeyName the serverKeyName value to set + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the server key. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get thumbprint of the server key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..23fe1881473a5 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsImpl.java @@ -0,0 +1,73 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceEncryptionProtectors; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceEncryptionProtector; + +class ManagedInstanceEncryptionProtectorsImpl extends WrapperImpl implements ManagedInstanceEncryptionProtectors { + private final SqlManager manager; + + ManagedInstanceEncryptionProtectorsImpl(SqlManager manager) { + super(manager.inner().managedInstanceEncryptionProtectors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedInstanceEncryptionProtectorsInner 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 ManagedInstanceEncryptionProtector call(ManagedInstanceEncryptionProtectorInner inner) { + return new ManagedInstanceEncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstanceEncryptionProtectorsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedInstanceEncryptionProtector call(ManagedInstanceEncryptionProtectorInner inner) { + return new ManagedInstanceEncryptionProtectorImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + ManagedInstanceEncryptionProtectorsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters) + .map(new Func1() { + @Override + public ManagedInstanceEncryptionProtector call(ManagedInstanceEncryptionProtectorInner inner) { + return new ManagedInstanceEncryptionProtectorImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsInner.java new file mode 100644 index 0000000000000..09f9c9a57ebc2 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceEncryptionProtectorsInner.java @@ -0,0 +1,580 @@ +/** + * 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.v3_2017_10.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 ManagedInstanceEncryptionProtectors. + */ +public class ManagedInstanceEncryptionProtectorsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceEncryptionProtectorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceEncryptionProtectorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceEncryptionProtectorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceEncryptionProtectorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceEncryptionProtectors to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceEncryptionProtectorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceEncryptionProtectors listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector") + 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.v3_2017_10.ManagedInstanceEncryptionProtectors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @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.v3_2017_10.ManagedInstanceEncryptionProtectors createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceEncryptionProtectorInner 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.v3_2017_10.ManagedInstanceEncryptionProtectors beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceEncryptionProtectorInner 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.v3_2017_10.ManagedInstanceEncryptionProtectors listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of managed instance encryption protectors. + * + * @param resourceGroupName The 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @param resourceGroupName The 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 instance encryption protectors. + * + * @param resourceGroupName The 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @param resourceGroupName The 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + 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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protector. + * + * @param resourceGroupName The 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 ManagedInstanceEncryptionProtectorInner object if successful. + */ + public ManagedInstanceEncryptionProtectorInner get(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 getAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 ManagedInstanceEncryptionProtectorInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedInstanceEncryptionProtectorInner>() { + @Override + public ManagedInstanceEncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed instance encryption protector. + * + * @param resourceGroupName The 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 ManagedInstanceEncryptionProtectorInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String encryptionProtectorName = "current"; + return service.get(resourceGroupName, managedInstanceName, encryptionProtectorName, 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); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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 ManagedInstanceEncryptionProtectorInner object if successful. + */ + public ManagedInstanceEncryptionProtectorInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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, ManagedInstanceEncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceEncryptionProtectorInner>() { + @Override + public ManagedInstanceEncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner 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); + final String encryptionProtectorName = "current"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, encryptionProtectorName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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 ManagedInstanceEncryptionProtectorInner object if successful. + */ + public ManagedInstanceEncryptionProtectorInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector 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, ManagedInstanceEncryptionProtectorInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceEncryptionProtectorInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceEncryptionProtectorInner>() { + @Override + public ManagedInstanceEncryptionProtectorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing encryption protector. + * + * @param resourceGroupName The 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 encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceEncryptionProtectorInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner 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); + final String encryptionProtectorName = "current"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, encryptionProtectorName, 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 list of managed instance encryption protectors. + * + * @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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @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 instance encryption protectors. + * + * @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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + * @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<ManagedInstanceEncryptionProtectorInner> 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 instance encryption protectors. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceEncryptionProtectorInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyImpl.java new file mode 100644 index 0000000000000..003c9e04978fa --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyImpl.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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceKey; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2017_10.ServerKeyType; +import org.joda.time.DateTime; + +class ManagedInstanceKeyImpl extends CreatableUpdatableImpl implements ManagedInstanceKey, ManagedInstanceKey.Definition, ManagedInstanceKey.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String keyName; + + ManagedInstanceKeyImpl(String name, SqlManager manager) { + super(name, new ManagedInstanceKeyInner()); + this.manager = manager; + // Set resource name + this.keyName = name; + // + } + + ManagedInstanceKeyImpl(ManagedInstanceKeyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.keyName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.keyName = IdParsingUtils.getValueFromIdByName(inner.id(), "keys"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedInstanceKeysInner client = this.manager().inner().managedInstanceKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedInstanceKeysInner client = this.manager().inner().managedInstanceKeys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.keyName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedInstanceKeysInner client = this.manager().inner().managedInstanceKeys(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.keyName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ServerKeyType serverKeyType() { + return this.inner().serverKeyType(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + + @Override + public ManagedInstanceKeyImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedInstanceKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.inner().withServerKeyType(serverKeyType); + return this; + } + + @Override + public ManagedInstanceKeyImpl withUri(String uri) { + this.inner().withUri(uri); + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyInner.java new file mode 100644 index 0000000000000..2bbbcce11e891 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeyInner.java @@ -0,0 +1,122 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ServerKeyType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed instance key. + */ +@JsonFlatten +public class ManagedInstanceKeyInner extends ProxyResource { + /** + * Kind of encryption protector. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The key type like 'ServiceManaged', 'AzureKeyVault'. Possible values + * include: 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /** + * The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI + * is required. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /** + * Thumbprint of the key. + */ + @JsonProperty(value = "properties.thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * The key creation date. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * Get kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set + * @return the ManagedInstanceKeyInner object itself. + */ + public ManagedInstanceKeyInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set + * @return the ManagedInstanceKeyInner object itself. + */ + public ManagedInstanceKeyInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get thumbprint of the key. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the key creation date. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysImpl.java new file mode 100644 index 0000000000000..0287b858fa4cb --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceKeys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceKey; + +class ManagedInstanceKeysImpl extends WrapperImpl implements ManagedInstanceKeys { + private final SqlManager manager; + + ManagedInstanceKeysImpl(SqlManager manager) { + super(manager.inner().managedInstanceKeys()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedInstanceKeyImpl define(String name) { + return wrapModel(name); + } + + private ManagedInstanceKeyImpl wrapModel(ManagedInstanceKeyInner inner) { + return new ManagedInstanceKeyImpl(inner, manager()); + } + + private ManagedInstanceKeyImpl wrapModel(String name) { + return new ManagedInstanceKeyImpl(name, this.manager()); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedInstanceKeysInner 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 ManagedInstanceKey call(ManagedInstanceKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String keyName) { + ManagedInstanceKeysInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, keyName) + .map(new Func1() { + @Override + public ManagedInstanceKey call(ManagedInstanceKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String keyName) { + ManagedInstanceKeysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, keyName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysInner.java new file mode 100644 index 0000000000000..285891c1e5382 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceKeysInner.java @@ -0,0 +1,899 @@ +/** + * 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.v3_2017_10.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 ManagedInstanceKeys. + */ +public class ManagedInstanceKeysInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceKeysService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceKeysInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceKeys listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys") + Observable> listByInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.v3_2017_10.ManagedInstanceKeys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @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.v3_2017_10.ManagedInstanceKeys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceKeyInner 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.v3_2017_10.ManagedInstanceKeys beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceKeyInner 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.v3_2017_10.ManagedInstanceKeys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @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.v3_2017_10.ManagedInstanceKeys beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("keyName") String keyName, @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.v3_2017_10.ManagedInstanceKeys listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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<ManagedInstanceKeyInner> 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 instance keys. + * + * @param resourceGroupName The 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 instance keys. + * + * @param resourceGroupName The 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<ManagedInstanceKeyInner> 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 instance keys. + * + * @param resourceGroupName The 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<ManagedInstanceKeyInner> 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 instance keys. + * + * @param resourceGroupName The 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 PagedList<ManagedInstanceKeyInner> 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."); + } + final String filter = null; + return service.listByInstance(resourceGroupName, managedInstanceName, 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 = listByInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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<ManagedInstanceKeyInner> object if successful. + */ + public PagedList listByInstance(final String resourceGroupName, final String managedInstanceName, final String filter) { + ServiceResponse> response = listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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<ManagedInstanceKeyInner> object + */ + public Observable> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName, final String filter) { + return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed instance keys. + * + * @param resourceGroupName The 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 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<ManagedInstanceKeyInner> object + */ + public Observable>> listByInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String filter) { + return listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, 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(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed instance keys. + * + 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 filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceKeyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceSinglePageAsync(final String resourceGroupName, final String managedInstanceName, 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 (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(), filter, 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 instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key 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 ManagedInstanceKeyInner object if successful. + */ + public ManagedInstanceKeyInner get(String resourceGroupName, String managedInstanceName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).toBlocking().single().body(); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key 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 getAsync(String resourceGroupName, String managedInstanceName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName), serviceCallback); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String keyName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).map(new Func1, ManagedInstanceKeyInner>() { + @Override + public ManagedInstanceKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 ManagedInstanceKeyInner object if successful. + */ + public ManagedInstanceKeyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 keyName, ManagedInstanceKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).map(new Func1, ManagedInstanceKeyInner>() { + @Override + public ManagedInstanceKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 ManagedInstanceKeyInner object if successful. + */ + public ManagedInstanceKeyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key 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 keyName, ManagedInstanceKeyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters).map(new Func1, ManagedInstanceKeyInner>() { + @Override + public ManagedInstanceKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance key. + * + * @param resourceGroupName The 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 keyName The name of the managed instance key to be operated on (updated or created). + * @param parameters The requested managed instance key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceKeyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).toBlocking().last().body(); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName), serviceCallback); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName, String keyName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).toBlocking().single().body(); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key 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 managedInstanceName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName), serviceCallback); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String managedInstanceName, String keyName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, keyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the managed instance key with the 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 managedInstanceName The name of the managed instance. + * @param keyName The name of the managed instance key to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String keyName) { + 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 (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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, keyName, 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 a list of managed instance keys. + * + * @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<ManagedInstanceKeyInner> 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 instance keys. + * + * @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 instance keys. + * + * @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<ManagedInstanceKeyInner> 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 instance keys. + * + * @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<ManagedInstanceKeyInner> 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 instance keys. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceKeyInner> 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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesImpl.java new file mode 100644 index 0000000000000..fcb2912d87ae8 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesImpl.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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceTdeCertificates; +import rx.Completable; + +class ManagedInstanceTdeCertificatesImpl extends WrapperImpl implements ManagedInstanceTdeCertificates { + private final SqlManager manager; + + ManagedInstanceTdeCertificatesImpl(SqlManager manager) { + super(manager.inner().managedInstanceTdeCertificates()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + ManagedInstanceTdeCertificatesInner client = this.inner(); + return client.createAsync(resourceGroupName, managedInstanceName, parameters).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesInner.java new file mode 100644 index 0000000000000..e7403487aca1c --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceTdeCertificatesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v3_2017_10.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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +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 ManagedInstanceTdeCertificates. + */ +public class ManagedInstanceTdeCertificatesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceTdeCertificatesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceTdeCertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceTdeCertificatesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceTdeCertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceTdeCertificates to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceTdeCertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceTdeCertificates create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner 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.v3_2017_10.ManagedInstanceTdeCertificates beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 + */ + public void create(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner 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.create(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 + */ + public void beginCreate(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or 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 beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner 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.beginCreate(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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..a53a306b6b5fa --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceVulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanTriggerType; + +class ManagedInstanceVulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements ManagedInstanceVulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private String scanId; + + ManagedInstanceVulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/PageImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/PageImpl.java new file mode 100644 index 0000000000000..44ffb97bb3746 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2017_10.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..40b624a638ad6 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.ServerVulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanTriggerType; + +class ServerVulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements ServerVulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String scanId; + + ServerVulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().databaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..1ab8bb8662d9d --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManagementClientImpl.java @@ -0,0 +1,392 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DatabaseOperationsInner object to access its operations. + */ + private DatabaseOperationsInner databaseOperations; + + /** + * Gets the DatabaseOperationsInner object to access its operations. + * @return the DatabaseOperationsInner object. + */ + public DatabaseOperationsInner databaseOperations() { + return this.databaseOperations; + } + + /** + * The ElasticPoolOperationsInner object to access its operations. + */ + private ElasticPoolOperationsInner elasticPoolOperations; + + /** + * Gets the ElasticPoolOperationsInner object to access its operations. + * @return the ElasticPoolOperationsInner object. + */ + public ElasticPoolOperationsInner elasticPoolOperations() { + return this.elasticPoolOperations; + } + + /** + * The CapabilitiesInner object to access its operations. + */ + private CapabilitiesInner capabilities; + + /** + * Gets the CapabilitiesInner object to access its operations. + * @return the CapabilitiesInner object. + */ + public CapabilitiesInner capabilities() { + return this.capabilities; + } + + /** + * 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 DatabaseVulnerabilityAssessmentScansInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans; + + /** + * Gets the DatabaseVulnerabilityAssessmentScansInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentScansInner object. + */ + public DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans() { + return this.databaseVulnerabilityAssessmentScans; + } + + /** + * The ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner managedDatabaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner managedDatabaseVulnerabilityAssessmentRuleBaselines() { + return this.managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * The ManagedDatabaseVulnerabilityAssessmentScansInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentScansInner managedDatabaseVulnerabilityAssessmentScans; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentScansInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentScansInner managedDatabaseVulnerabilityAssessmentScans() { + return this.managedDatabaseVulnerabilityAssessmentScans; + } + + /** + * The ManagedDatabaseVulnerabilityAssessmentsInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentsInner managedDatabaseVulnerabilityAssessments; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentsInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentsInner managedDatabaseVulnerabilityAssessments() { + return this.managedDatabaseVulnerabilityAssessments; + } + + /** + * The InstanceFailoverGroupsInner object to access its operations. + */ + private InstanceFailoverGroupsInner instanceFailoverGroups; + + /** + * Gets the InstanceFailoverGroupsInner object to access its operations. + * @return the InstanceFailoverGroupsInner object. + */ + public InstanceFailoverGroupsInner instanceFailoverGroups() { + return this.instanceFailoverGroups; + } + + /** + * The BackupShortTermRetentionPoliciesInner object to access its operations. + */ + private BackupShortTermRetentionPoliciesInner backupShortTermRetentionPolicies; + + /** + * Gets the BackupShortTermRetentionPoliciesInner object to access its operations. + * @return the BackupShortTermRetentionPoliciesInner object. + */ + public BackupShortTermRetentionPoliciesInner backupShortTermRetentionPolicies() { + return this.backupShortTermRetentionPolicies; + } + + /** + * The TdeCertificatesInner object to access its operations. + */ + private TdeCertificatesInner tdeCertificates; + + /** + * Gets the TdeCertificatesInner object to access its operations. + * @return the TdeCertificatesInner object. + */ + public TdeCertificatesInner tdeCertificates() { + return this.tdeCertificates; + } + + /** + * The ManagedInstanceTdeCertificatesInner object to access its operations. + */ + private ManagedInstanceTdeCertificatesInner managedInstanceTdeCertificates; + + /** + * Gets the ManagedInstanceTdeCertificatesInner object to access its operations. + * @return the ManagedInstanceTdeCertificatesInner object. + */ + public ManagedInstanceTdeCertificatesInner managedInstanceTdeCertificates() { + return this.managedInstanceTdeCertificates; + } + + /** + * The ManagedInstanceKeysInner object to access its operations. + */ + private ManagedInstanceKeysInner managedInstanceKeys; + + /** + * Gets the ManagedInstanceKeysInner object to access its operations. + * @return the ManagedInstanceKeysInner object. + */ + public ManagedInstanceKeysInner managedInstanceKeys() { + return this.managedInstanceKeys; + } + + /** + * The ManagedInstanceEncryptionProtectorsInner object to access its operations. + */ + private ManagedInstanceEncryptionProtectorsInner managedInstanceEncryptionProtectors; + + /** + * Gets the ManagedInstanceEncryptionProtectorsInner object to access its operations. + * @return the ManagedInstanceEncryptionProtectorsInner object. + */ + public ManagedInstanceEncryptionProtectorsInner managedInstanceEncryptionProtectors() { + return this.managedInstanceEncryptionProtectors; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-10-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); + this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); + this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.instanceFailoverGroups = new InstanceFailoverGroupsInner(restClient().retrofit(), this); + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); + this.tdeCertificates = new TdeCertificatesInner(restClient().retrofit(), this); + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesInner(restClient().retrofit(), this); + this.managedInstanceKeys = new ManagedInstanceKeysInner(restClient().retrofit(), this); + this.managedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2017-10-01-preview"); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManager.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManager.java new file mode 100644 index 0000000000000..9ecd8c1e48a36 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/SqlManager.java @@ -0,0 +1,267 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseOperations; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPoolOperations; +import com.microsoft.azure.management.sql.v3_2017_10.Capabilities; +import com.microsoft.azure.management.sql.v3_2017_10.Databases; +import com.microsoft.azure.management.sql.v3_2017_10.ElasticPools; +import com.microsoft.azure.management.sql.v3_2017_10.DatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedDatabaseVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v3_2017_10.InstanceFailoverGroups; +import com.microsoft.azure.management.sql.v3_2017_10.BackupShortTermRetentionPolicies; +import com.microsoft.azure.management.sql.v3_2017_10.TdeCertificates; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceTdeCertificates; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceKeys; +import com.microsoft.azure.management.sql.v3_2017_10.ManagedInstanceEncryptionProtectors; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private DatabaseOperations databaseOperations; + private ElasticPoolOperations elasticPoolOperations; + private Capabilities capabilities; + private Databases databases; + private ElasticPools elasticPools; + private DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans; + private ManagedDatabaseVulnerabilityAssessmentRuleBaselines managedDatabaseVulnerabilityAssessmentRuleBaselines; + private ManagedDatabaseVulnerabilityAssessmentScans managedDatabaseVulnerabilityAssessmentScans; + private ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments; + private InstanceFailoverGroups instanceFailoverGroups; + private BackupShortTermRetentionPolicies backupShortTermRetentionPolicies; + private TdeCertificates tdeCertificates; + private ManagedInstanceTdeCertificates managedInstanceTdeCertificates; + private ManagedInstanceKeys managedInstanceKeys; + private ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DatabaseOperations. + */ + public DatabaseOperations databaseOperations() { + if (this.databaseOperations == null) { + this.databaseOperations = new DatabaseOperationsImpl(this); + } + return this.databaseOperations; + } + + /** + * @return Entry point to manage ElasticPoolOperations. + */ + public ElasticPoolOperations elasticPoolOperations() { + if (this.elasticPoolOperations == null) { + this.elasticPoolOperations = new ElasticPoolOperationsImpl(this); + } + return this.elasticPoolOperations; + } + + /** + * @return Entry point to manage Capabilities. + */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(this); + } + return this.capabilities; + } + + /** + * @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 DatabaseVulnerabilityAssessmentScans. + */ + public DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans() { + if (this.databaseVulnerabilityAssessmentScans == null) { + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansImpl(this); + } + return this.databaseVulnerabilityAssessmentScans; + } + + /** + * @return Entry point to manage ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselines managedDatabaseVulnerabilityAssessmentRuleBaselines() { + if (this.managedDatabaseVulnerabilityAssessmentRuleBaselines == null) { + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl(this); + } + return this.managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * @return Entry point to manage ManagedDatabaseVulnerabilityAssessmentScans. + */ + public ManagedDatabaseVulnerabilityAssessmentScans managedDatabaseVulnerabilityAssessmentScans() { + if (this.managedDatabaseVulnerabilityAssessmentScans == null) { + this.managedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansImpl(this); + } + return this.managedDatabaseVulnerabilityAssessmentScans; + } + + /** + * @return Entry point to manage ManagedDatabaseVulnerabilityAssessments. + */ + public ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments() { + if (this.managedDatabaseVulnerabilityAssessments == null) { + this.managedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsImpl(this); + } + return this.managedDatabaseVulnerabilityAssessments; + } + + /** + * @return Entry point to manage InstanceFailoverGroups. + */ + public InstanceFailoverGroups instanceFailoverGroups() { + if (this.instanceFailoverGroups == null) { + this.instanceFailoverGroups = new InstanceFailoverGroupsImpl(this); + } + return this.instanceFailoverGroups; + } + + /** + * @return Entry point to manage BackupShortTermRetentionPolicies. + */ + public BackupShortTermRetentionPolicies backupShortTermRetentionPolicies() { + if (this.backupShortTermRetentionPolicies == null) { + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesImpl(this); + } + return this.backupShortTermRetentionPolicies; + } + + /** + * @return Entry point to manage TdeCertificates. + */ + public TdeCertificates tdeCertificates() { + if (this.tdeCertificates == null) { + this.tdeCertificates = new TdeCertificatesImpl(this); + } + return this.tdeCertificates; + } + + /** + * @return Entry point to manage ManagedInstanceTdeCertificates. + */ + public ManagedInstanceTdeCertificates managedInstanceTdeCertificates() { + if (this.managedInstanceTdeCertificates == null) { + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesImpl(this); + } + return this.managedInstanceTdeCertificates; + } + + /** + * @return Entry point to manage ManagedInstanceKeys. + */ + public ManagedInstanceKeys managedInstanceKeys() { + if (this.managedInstanceKeys == null) { + this.managedInstanceKeys = new ManagedInstanceKeysImpl(this); + } + return this.managedInstanceKeys; + } + + /** + * @return Entry point to manage ManagedInstanceEncryptionProtectors. + */ + public ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors() { + if (this.managedInstanceEncryptionProtectors == null) { + this.managedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsImpl(this); + } + return this.managedInstanceEncryptionProtectors; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificateInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificateInner.java new file mode 100644 index 0000000000000..82d93c3101324 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificateInner.java @@ -0,0 +1,72 @@ +/** + * 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.v3_2017_10.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A TDE certificate that can be uploaded into a server. + */ +@JsonFlatten +public class TdeCertificateInner extends ProxyResource { + /** + * The base64 encoded certificate private blob. + */ + @JsonProperty(value = "properties.privateBlob", required = true) + private String privateBlob; + + /** + * The certificate password. + */ + @JsonProperty(value = "properties.certPassword") + private String certPassword; + + /** + * Get the base64 encoded certificate private blob. + * + * @return the privateBlob value + */ + public String privateBlob() { + return this.privateBlob; + } + + /** + * Set the base64 encoded certificate private blob. + * + * @param privateBlob the privateBlob value to set + * @return the TdeCertificateInner object itself. + */ + public TdeCertificateInner withPrivateBlob(String privateBlob) { + this.privateBlob = privateBlob; + return this; + } + + /** + * Get the certificate password. + * + * @return the certPassword value + */ + public String certPassword() { + return this.certPassword; + } + + /** + * Set the certificate password. + * + * @param certPassword the certPassword value to set + * @return the TdeCertificateInner object itself. + */ + public TdeCertificateInner withCertPassword(String certPassword) { + this.certPassword = certPassword; + return this; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesImpl.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesImpl.java new file mode 100644 index 0000000000000..641ab0051cfbf --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesImpl.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.v3_2017_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2017_10.TdeCertificates; +import rx.Completable; + +class TdeCertificatesImpl extends WrapperImpl implements TdeCertificates { + private final SqlManager manager; + + TdeCertificatesImpl(SqlManager manager) { + super(manager.inner().tdeCertificates()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + TdeCertificatesInner client = this.inner(); + return client.createAsync(resourceGroupName, serverName, parameters).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesInner.java new file mode 100644 index 0000000000000..6e5a41bbeffc7 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/TdeCertificatesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v3_2017_10.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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +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 TdeCertificates. + */ +public class TdeCertificatesInner { + /** The Retrofit service to perform REST calls. */ + private TdeCertificatesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TdeCertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TdeCertificatesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TdeCertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TdeCertificates to be + * used by Retrofit to perform actually REST calls. + */ + interface TdeCertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2017_10.TdeCertificates create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/tdeCertificates") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner 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.v3_2017_10.TdeCertificates beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/tdeCertificates") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 + */ + public void create(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + createWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, TdeCertificateInner 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 (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.create(resourceGroupName, serverName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 + */ + public void beginCreate(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or 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 beginCreateAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate for a given 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 parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, TdeCertificateInner 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 (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.beginCreate(resourceGroupName, serverName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/VulnerabilityAssessmentScanRecordInner.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/VulnerabilityAssessmentScanRecordInner.java new file mode 100644 index 0000000000000..223ad853b329b --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/VulnerabilityAssessmentScanRecordInner.java @@ -0,0 +1,146 @@ +/** + * 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.v3_2017_10.implementation; + +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanTriggerType; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanState; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v3_2017_10.VulnerabilityAssessmentScanError; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A vulnerability assessment scan record. + */ +@JsonFlatten +public class VulnerabilityAssessmentScanRecordInner extends ProxyResource { + /** + * The scan ID. + */ + @JsonProperty(value = "properties.scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /** + * The scan trigger type. Possible values include: 'OnDemand', 'Recurring'. + */ + @JsonProperty(value = "properties.triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /** + * The scan status. Possible values include: 'Passed', 'Failed', + * 'FailedToRun', 'InProgress'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /** + * The scan start time (UTC). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The scan end time (UTC). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The scan errors. + */ + @JsonProperty(value = "properties.errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * The scan results storage container path. + */ + @JsonProperty(value = "properties.storageContainerPath", access = JsonProperty.Access.WRITE_ONLY) + private String storageContainerPath; + + /** + * The number of failed security checks. + */ + @JsonProperty(value = "properties.numberOfFailedSecurityChecks", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFailedSecurityChecks; + + /** + * Get the scan ID. + * + * @return the scanId value + */ + public String scanId() { + return this.scanId; + } + + /** + * Get the scan trigger type. Possible values include: 'OnDemand', 'Recurring'. + * + * @return the triggerType value + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Get the scan status. Possible values include: 'Passed', 'Failed', 'FailedToRun', 'InProgress'. + * + * @return the state value + */ + public VulnerabilityAssessmentScanState state() { + return this.state; + } + + /** + * Get the scan start time (UTC). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the scan end time (UTC). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the scan errors. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Get the scan results storage container path. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Get the number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value + */ + public Integer numberOfFailedSecurityChecks() { + return this.numberOfFailedSecurityChecks; + } + +} diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/package-info.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/package-info.java new file mode 100644 index 0000000000000..9ed733b150557 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2017_10.implementation; diff --git a/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/package-info.java b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/package-info.java new file mode 100644 index 0000000000000..ad04cb2b4d419 --- /dev/null +++ b/sql/resource-manager/v3_2017_10/src/main/java/com/microsoft/azure/management/sql/v3_2017_10/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2017_10; diff --git a/sql/resource-manager/v3_2018_06/pom.xml b/sql/resource-manager/v3_2018_06/pom.xml new file mode 100644 index 0000000000000..b237b2f7bab09 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v3_2018_06 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessment.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessment.java new file mode 100644 index 0000000000000..41c45de9ad6ae --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessment.java @@ -0,0 +1,175 @@ +/** + * 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.v3_2018_06; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2018_06.implementation.ManagedInstanceVulnerabilityAssessmentInner; +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.v3_2018_06.implementation.SqlManager; + +/** + * Type representing ManagedInstanceVulnerabilityAssessment. + */ +public interface ManagedInstanceVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedInstanceVulnerabilityAssessment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedInstanceVulnerabilityAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedInstanceVulnerabilityAssessment definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + */ + WithStorageContainerPath withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedinstancevulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a ManagedInstanceVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerSasKey { + } + + /** + * Grouping of ManagedInstanceVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the managedinstancevulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the managedinstancevulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedinstancevulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessments.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessments.java new file mode 100644 index 0000000000000..0d57c8cab5218 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ManagedInstanceVulnerabilityAssessments.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.v3_2018_06; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2018_06.ManagedInstanceVulnerabilityAssessment; +import rx.Completable; + +/** + * Type representing ManagedInstanceVulnerabilityAssessments. + */ +public interface ManagedInstanceVulnerabilityAssessments { + /** + * Begins definition for a new VulnerabilityAssessment resource. + * @param name resource name. + * @return the first stage of the new VulnerabilityAssessment definition. + */ + ManagedInstanceVulnerabilityAssessment.DefinitionStages.Blank defineVulnerabilityAssessment(String name); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName); + + /** + * Gets the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName); + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessment.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessment.java new file mode 100644 index 0000000000000..c3365aa36ff16 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessment.java @@ -0,0 +1,175 @@ +/** + * 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.v3_2018_06; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v3_2018_06.implementation.ServerVulnerabilityAssessmentInner; +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.v3_2018_06.implementation.SqlManager; + +/** + * Type representing ServerVulnerabilityAssessment. + */ +public interface ServerVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServerVulnerabilityAssessment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServerVulnerabilityAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServerVulnerabilityAssessment definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithStorageContainerPath withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the servervulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a ServerVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerSasKey { + } + + /** + * Grouping of ServerVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the servervulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the servervulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the servervulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessments.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessments.java new file mode 100644 index 0000000000000..581249e5fdb47 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/ServerVulnerabilityAssessments.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.v3_2018_06; + +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2018_06.ServerVulnerabilityAssessment; +import rx.Completable; + +/** + * Type representing ServerVulnerabilityAssessments. + */ +public interface ServerVulnerabilityAssessments { + /** + * Begins definition for a new VulnerabilityAssessment resource. + * @param name resource name. + * @return the first stage of the new VulnerabilityAssessment definition. + */ + ServerVulnerabilityAssessment.DefinitionStages.Blank defineVulnerabilityAssessment(String name); + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName); + + /** + * Lists the vulnerability assessment policies associated with 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); + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName); + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/VulnerabilityAssessmentRecurringScansProperties.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..7ce1f6071bef8 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,98 @@ +/** + * 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.v3_2018_06; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get recurring scans state. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set recurring scans state. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/IdParsingUtils.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..c1a8a49f10948 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v3_2018_06.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..15b75f5c24c4d --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentImpl.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.v3_2018_06.implementation; + +import com.microsoft.azure.management.sql.v3_2018_06.ManagedInstanceVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2018_06.VulnerabilityAssessmentRecurringScansProperties; + +class ManagedInstanceVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements ManagedInstanceVulnerabilityAssessment, ManagedInstanceVulnerabilityAssessment.Definition, ManagedInstanceVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + + ManagedInstanceVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new ManagedInstanceVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.managedInstanceName = name; + // + } + + ManagedInstanceVulnerabilityAssessmentImpl(ManagedInstanceVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.managedInstanceName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedInstanceVulnerabilityAssessmentsInner client = this.manager().inner().managedInstanceVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedInstanceVulnerabilityAssessmentsInner client = this.manager().inner().managedInstanceVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedInstanceVulnerabilityAssessmentsInner client = this.manager().inner().managedInstanceVulnerabilityAssessments(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName); + } + + @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 VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentInner.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..e73c457821c66 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentInner.java @@ -0,0 +1,131 @@ +/** + * 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.v3_2018_06.implementation; + +import com.microsoft.azure.management.sql.v3_2018_06.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed instance vulnerability assessment. + */ +@JsonFlatten +public class ManagedInstanceVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..e36a702159681 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.v3_2018_06.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2018_06.ManagedInstanceVulnerabilityAssessments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2018_06.ManagedInstanceVulnerabilityAssessment; +import com.microsoft.azure.Page; +import rx.Completable; + +class ManagedInstanceVulnerabilityAssessmentsImpl extends WrapperImpl implements ManagedInstanceVulnerabilityAssessments { + private final SqlManager manager; + + ManagedInstanceVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().managedInstanceVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedInstanceVulnerabilityAssessmentImpl defineVulnerabilityAssessment(String name) { + return wrapVulnerabilityAssessmentModel(name); + } + + private ManagedInstanceVulnerabilityAssessmentImpl wrapVulnerabilityAssessmentModel(String name) { + return new ManagedInstanceVulnerabilityAssessmentImpl(name, this.manager()); + } + + private ManagedInstanceVulnerabilityAssessmentImpl wrapManagedInstanceVulnerabilityAssessmentModel(ManagedInstanceVulnerabilityAssessmentInner inner) { + return new ManagedInstanceVulnerabilityAssessmentImpl(inner, manager()); + } + + private Observable getManagedInstanceVulnerabilityAssessmentInnerUsingManagedInstanceVulnerabilityAssessmentsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + ManagedInstanceVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstanceVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedInstanceVulnerabilityAssessment call(ManagedInstanceVulnerabilityAssessmentInner inner) { + return wrapManagedInstanceVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedInstanceVulnerabilityAssessmentsInner 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 ManagedInstanceVulnerabilityAssessment call(ManagedInstanceVulnerabilityAssessmentInner inner) { + return wrapManagedInstanceVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstanceVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..5dc54cbd53d9c --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java @@ -0,0 +1,590 @@ +/** + * 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.v3_2018_06.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 ManagedInstanceVulnerabilityAssessments. + */ +public class ManagedInstanceVulnerabilityAssessmentsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2018_06.ManagedInstanceVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2018_06.ManagedInstanceVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceVulnerabilityAssessmentInner 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.v3_2018_06.ManagedInstanceVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2018_06.ManagedInstanceVulnerabilityAssessments listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments") + 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.v3_2018_06.ManagedInstanceVulnerabilityAssessments listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 ManagedInstanceVulnerabilityAssessmentInner object if successful. + */ + public ManagedInstanceVulnerabilityAssessmentInner get(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedInstanceVulnerabilityAssessmentInner>() { + @Override + public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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 managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 ManagedInstanceVulnerabilityAssessmentInner object if successful. + */ + public ManagedInstanceVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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, ManagedInstanceVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceVulnerabilityAssessmentInner>() { + @Override + public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner 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); + final String vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String managedInstanceName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 deleteAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, 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); + } + + /** + * Gets the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments 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<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments 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> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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> 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 the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> object + */ + public Observable> listByInstanceNextAsync(final String nextPageLink) { + return listByInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> 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 the managed instance's vulnerability assessment 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<ManagedInstanceVulnerabilityAssessmentInner> 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/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/PageImpl.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/PageImpl.java new file mode 100644 index 0000000000000..81dfbab500f7e --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v3_2018_06.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentImpl.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..3061197970eb8 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentImpl.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.v3_2018_06.implementation; + +import com.microsoft.azure.management.sql.v3_2018_06.ServerVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v3_2018_06.VulnerabilityAssessmentRecurringScansProperties; + +class ServerVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements ServerVulnerabilityAssessment, ServerVulnerabilityAssessment.Definition, ServerVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + + ServerVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new ServerVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.serverName = name; + // + } + + ServerVulnerabilityAssessmentImpl(ServerVulnerabilityAssessmentInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serverName = inner.name(); + // resource ancestor names + 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() { + ServerVulnerabilityAssessmentsInner client = this.manager().inner().serverVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServerVulnerabilityAssessmentsInner client = this.manager().inner().serverVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServerVulnerabilityAssessmentsInner client = this.manager().inner().serverVulnerabilityAssessments(); + return client.getAsync(this.resourceGroupName, this.serverName); + } + + @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 VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ServerVulnerabilityAssessmentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ServerVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentInner.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..1fb3479d61292 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentInner.java @@ -0,0 +1,131 @@ +/** + * 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.v3_2018_06.implementation; + +import com.microsoft.azure.management.sql.v3_2018_06.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A server vulnerability assessment. + */ +@JsonFlatten +public class ServerVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * 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. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * 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. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.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. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..71aeba069a74e --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.v3_2018_06.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v3_2018_06.ServerVulnerabilityAssessments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v3_2018_06.ServerVulnerabilityAssessment; +import com.microsoft.azure.Page; +import rx.Completable; + +class ServerVulnerabilityAssessmentsImpl extends WrapperImpl implements ServerVulnerabilityAssessments { + private final SqlManager manager; + + ServerVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().serverVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ServerVulnerabilityAssessmentImpl defineVulnerabilityAssessment(String name) { + return wrapVulnerabilityAssessmentModel(name); + } + + private ServerVulnerabilityAssessmentImpl wrapVulnerabilityAssessmentModel(String name) { + return new ServerVulnerabilityAssessmentImpl(name, this.manager()); + } + + private ServerVulnerabilityAssessmentImpl wrapServerVulnerabilityAssessmentModel(ServerVulnerabilityAssessmentInner inner) { + return new ServerVulnerabilityAssessmentImpl(inner, manager()); + } + + private Observable getServerVulnerabilityAssessmentInnerUsingServerVulnerabilityAssessmentsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + ServerVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName) { + ServerVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName) + .map(new Func1() { + @Override + public ServerVulnerabilityAssessment call(ServerVulnerabilityAssessmentInner inner) { + return wrapServerVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerVulnerabilityAssessmentsInner 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 ServerVulnerabilityAssessment call(ServerVulnerabilityAssessmentInner inner) { + return wrapServerVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName) { + ServerVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsInner.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..5f5c3feefe0b3 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/ServerVulnerabilityAssessmentsInner.java @@ -0,0 +1,590 @@ +/** + * 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.v3_2018_06.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 ServerVulnerabilityAssessments. + */ +public class ServerVulnerabilityAssessmentsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ServerVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServerVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServerVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServerVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface ServerVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v3_2018_06.ServerVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2018_06.ServerVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body ServerVulnerabilityAssessmentInner 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.v3_2018_06.ServerVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.v3_2018_06.ServerVulnerabilityAssessments listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments") + 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.v3_2018_06.ServerVulnerabilityAssessments listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 ServerVulnerabilityAssessmentInner object if successful. + */ + public ServerVulnerabilityAssessmentInner get(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName) { + return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerVulnerabilityAssessmentInner>() { + @Override + public ServerVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, vulnerabilityAssessmentName, 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 server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 ServerVulnerabilityAssessmentInner object if successful. + */ + public ServerVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String serverName, ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested 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 serverName, ServerVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerVulnerabilityAssessmentInner>() { + @Override + public ServerVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerVulnerabilityAssessmentInner 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 (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 vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, serverName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String serverName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment 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 deleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the server's vulnerability assessment. + * + * @param resourceGroupName The 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 for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, 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."); + } + final String vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, serverName, vulnerabilityAssessmentName, 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment policies associated with 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment policies associated with 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); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment policies associated with 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<ServerVulnerabilityAssessmentInner> 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/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..d876076f93437 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManagementClientImpl.java @@ -0,0 +1,210 @@ +/** + * 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.v3_2018_06.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ManagedInstanceVulnerabilityAssessmentsInner object to access its operations. + */ + private ManagedInstanceVulnerabilityAssessmentsInner managedInstanceVulnerabilityAssessments; + + /** + * Gets the ManagedInstanceVulnerabilityAssessmentsInner object to access its operations. + * @return the ManagedInstanceVulnerabilityAssessmentsInner object. + */ + public ManagedInstanceVulnerabilityAssessmentsInner managedInstanceVulnerabilityAssessments() { + return this.managedInstanceVulnerabilityAssessments; + } + + /** + * The ServerVulnerabilityAssessmentsInner object to access its operations. + */ + private ServerVulnerabilityAssessmentsInner serverVulnerabilityAssessments; + + /** + * Gets the ServerVulnerabilityAssessmentsInner object to access its operations. + * @return the ServerVulnerabilityAssessmentsInner object. + */ + public ServerVulnerabilityAssessmentsInner serverVulnerabilityAssessments() { + return this.serverVulnerabilityAssessments; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-06-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2018-06-01-preview"); + } +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManager.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManager.java new file mode 100644 index 0000000000000..9a4aeda2f61f5 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/SqlManager.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.v3_2018_06.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v3_2018_06.ManagedInstanceVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v3_2018_06.ServerVulnerabilityAssessments; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments; + private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ManagedInstanceVulnerabilityAssessments. + */ + public ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments() { + if (this.managedInstanceVulnerabilityAssessments == null) { + this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsImpl(this); + } + return this.managedInstanceVulnerabilityAssessments; + } + + /** + * @return Entry point to manage ServerVulnerabilityAssessments. + */ + public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { + if (this.serverVulnerabilityAssessments == null) { + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsImpl(this); + } + return this.serverVulnerabilityAssessments; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/package-info.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/package-info.java new file mode 100644 index 0000000000000..0b2bcba32762e --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2018_06.implementation; diff --git a/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/package-info.java b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/package-info.java new file mode 100644 index 0000000000000..d54f53665e5a1 --- /dev/null +++ b/sql/resource-manager/v3_2018_06/src/main/java/com/microsoft/azure/management/sql/v3_2018_06/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v3_2018_06; From 454cecdecd102cc57d46a7d5677f00ce619004c7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 13 Dec 2018 10:08:19 -0800 Subject: [PATCH 09/17] Generated from 9d8ee581a6a578917bf10678c5d69d7e08d57c7f (#2786) Updating managed database swagger --- .../v2017_03_01_preview/ManagedDatabase.java | 54 +++++++++++++- .../ManagedDatabaseCreateMode.java | 3 + .../ManagedDatabaseStatus.java | 3 + .../ManagedDatabaseUpdate.java | 71 +++++++++++++++++-- .../v2017_03_01_preview/ManagedDatabases.java | 2 +- .../implementation/ManagedDatabaseImpl.java | 30 ++++++++ .../implementation/ManagedDatabaseInner.java | 71 +++++++++++++++++-- .../implementation/ManagedDatabasesInner.java | 16 ++--- 8 files changed, 225 insertions(+), 25 deletions(-) diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java index 16b255adeb709..4c92e14b53fdc 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java @@ -74,6 +74,16 @@ public interface ManagedDatabase extends HasInner, Indexab */ String name(); + /** + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + /** * @return the restorePointInTime value. */ @@ -175,6 +185,26 @@ interface WithCreateMode { WithCreate withCreateMode(ManagedDatabaseCreateMode createMode); } + /** + * The stage of the manageddatabase definition allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the manageddatabase definition allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** * The stage of the manageddatabase definition allowing to specify RestorePointInTime. */ @@ -230,13 +260,13 @@ interface WithTags { * 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.WithRestorePointInTime, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithStorageContainerSasToken, DefinitionStages.WithStorageContainerUri, DefinitionStages.WithTags { + interface WithCreate extends Creatable, DefinitionStages.WithCatalogCollation, DefinitionStages.WithCollation, DefinitionStages.WithCreateMode, 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.WithRestorePointInTime, UpdateStages.WithSourceDatabaseId, UpdateStages.WithStorageContainerSasToken, UpdateStages.WithStorageContainerUri, UpdateStages.WithTags { + interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSourceDatabaseId, UpdateStages.WithStorageContainerSasToken, UpdateStages.WithStorageContainerUri, UpdateStages.WithTags { } /** @@ -273,6 +303,26 @@ interface WithCreateMode { Update withCreateMode(ManagedDatabaseCreateMode createMode); } + /** + * The stage of the manageddatabase update allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the manageddatabase update allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** * The stage of the manageddatabase update allowing to specify RestorePointInTime. */ diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java index 401fce50ffa2b..f54d0ace4220f 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java @@ -25,6 +25,9 @@ public final class ManagedDatabaseCreateMode extends ExpandableStringEnum listByInstanceAsync(final String resourceGroupName, final String managedInstanceName); /** - * Deletes the managed database. + * 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. diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java index 19696f74c3064..07ca0dfe8d745 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java @@ -146,6 +146,16 @@ 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(); @@ -224,6 +234,26 @@ public ManagedDatabaseImpl withCreateMode(ManagedDatabaseCreateMode createMode) 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()) { diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java index 9f704415711c2..d02e6a1de06e0 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java @@ -28,8 +28,8 @@ public class ManagedDatabaseInner extends Resource { private String collation; /** - * Status for the database. Possible values include: 'Online', 'Offline', - * 'Shutdown', 'Creating', 'Inaccessible'. + * Status of the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible', 'Updating'. */ @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) private ManagedDatabaseStatus status; @@ -73,8 +73,11 @@ public class ManagedDatabaseInner extends Resource { * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be * specified. RestoreExternalBackup: Create a database by restoring from * external backup files. Collation, StorageContainerUri and - * StorageContainerSasToken must be specified. Possible values include: - * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * 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'. */ @JsonProperty(value = "properties.createMode") private ManagedDatabaseCreateMode createMode; @@ -94,6 +97,13 @@ public class ManagedDatabaseInner extends Resource { @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. @@ -108,6 +118,13 @@ public class ManagedDatabaseInner extends Resource { @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; + /** * Get collation of the managed database. * @@ -129,7 +146,7 @@ public ManagedDatabaseInner withCollation(String collation) { } /** - * Get status for the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible'. + * Get status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating'. * * @return the status value */ @@ -205,7 +222,7 @@ public ManagedDatabaseInner withCatalogCollation(CatalogCollationType catalogCol } /** - * 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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * 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'. * * @return the createMode value */ @@ -214,7 +231,7 @@ public ManagedDatabaseCreateMode 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. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * 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'. * * @param createMode the createMode value to set * @return the ManagedDatabaseInner object itself. @@ -264,6 +281,26 @@ public ManagedDatabaseInner withSourceDatabaseId(String 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. * @@ -293,4 +330,24 @@ 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; + } + } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java index 978f15b2b56c8..db23e9b7f3bab 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java @@ -688,7 +688,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Respon } /** - * Deletes the managed database. + * 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. @@ -702,7 +702,7 @@ public void delete(String resourceGroupName, String managedInstanceName, String } /** - * Deletes the managed database. + * 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. @@ -716,7 +716,7 @@ public ServiceFuture deleteAsync(String resourceGroupName, String managedI } /** - * Deletes the managed database. + * 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. @@ -734,7 +734,7 @@ public Void call(ServiceResponse response) { } /** - * Deletes the managed database. + * 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. @@ -763,7 +763,7 @@ public Observable> deleteWithServiceResponseAsync(String r } /** - * Deletes the managed database. + * 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. @@ -777,7 +777,7 @@ public void beginDelete(String resourceGroupName, String managedInstanceName, St } /** - * Deletes the managed database. + * 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. @@ -791,7 +791,7 @@ public ServiceFuture beginDeleteAsync(String resourceGroupName, String man } /** - * Deletes the managed database. + * 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. @@ -809,7 +809,7 @@ public Void call(ServiceResponse response) { } /** - * Deletes the managed database. + * 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. From 06e4e608f37edc4660b729dac50eca965b446bcf Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 13 Dec 2018 14:28:52 -0800 Subject: [PATCH 10/17] Generated from 9d6a28b409c220cdac4477e608e14fbed6bd7c6e (#2787) Fix ManagedDatabaseSecurityAlertCreateMin example file --- .../ManagedDatabaseSecurityAlertPolicies.java | 31 ++ .../ManagedDatabaseSecurityAlertPolicy.java | 257 ++++++++++++++ .../ManagedServerSecurityAlertPolicies.java | 34 ++ .../ManagedServerSecurityAlertPolicy.java | 257 ++++++++++++++ .../ServerSecurityAlertPolicy.java | 6 + ...agedDatabaseSecurityAlertPoliciesImpl.java | 55 +++ ...gedDatabaseSecurityAlertPoliciesInner.java | 264 ++++++++++++++ ...anagedDatabaseSecurityAlertPolicyImpl.java | 180 ++++++++++ ...nagedDatabaseSecurityAlertPolicyInner.java | 226 ++++++++++++ ...anagedServerSecurityAlertPoliciesImpl.java | 62 ++++ ...nagedServerSecurityAlertPoliciesInner.java | 332 ++++++++++++++++++ .../ManagedServerSecurityAlertPolicyImpl.java | 177 ++++++++++ ...ManagedServerSecurityAlertPolicyInner.java | 226 ++++++++++++ .../ServerSecurityAlertPolicyImpl.java | 6 + .../ServerSecurityAlertPolicyInner.java | 16 + .../SqlManagementClientImpl.java | 28 ++ .../implementation/SqlManager.java | 24 ++ 17 files changed, 2181 insertions(+) create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicies.java new file mode 100644 index 0000000000000..b630ce2290b74 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedDatabaseSecurityAlertPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedDatabaseSecurityAlertPolicies. + */ +public interface ManagedDatabaseSecurityAlertPolicies extends SupportsCreating, HasInner { + /** + * Gets a managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed 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 managedInstanceName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..a1118f57bae57 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java @@ -0,0 +1,257 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedDatabaseSecurityAlertPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing ManagedDatabaseSecurityAlertPolicy. + */ +public interface ManagedDatabaseSecurityAlertPolicy 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 ManagedDatabaseSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedDatabaseSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedDatabaseSecurityAlertPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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 ManagedDatabaseSecurityAlertPolicy 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 ManagedDatabaseSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..0132f1a4cf722 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.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. + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview; + +import rx.Observable; + +/** + * Type representing ManagedServerSecurityAlertPolicies. + */ +public interface ManagedServerSecurityAlertPolicies { + /** + * Begins definition for a new SecurityAlertPolicy resource. + * @param name resource name. + * @return the first stage of the new SecurityAlertPolicy definition. + */ + ManagedServerSecurityAlertPolicy.DefinitionStages.Blank defineSecurityAlertPolicy(String name); + + /** + * Get a managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..45e719449b3fd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java @@ -0,0 +1,257 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedServerSecurityAlertPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing ManagedServerSecurityAlertPolicy. + */ +public interface ManagedServerSecurityAlertPolicy 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 ManagedServerSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedServerSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedServerSecurityAlertPolicy definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + */ + WithState withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + 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 ManagedServerSecurityAlertPolicy 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 ManagedServerSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java index 186e024a92108..4cb5c7f300120 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java @@ -18,11 +18,17 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; import java.util.List; +import org.joda.time.DateTime; /** * Type representing ServerSecurityAlertPolicy. */ public interface ServerSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + /** * @return the disabledAlerts value. */ diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..1de57a3805c5c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicy; + +class ManagedDatabaseSecurityAlertPoliciesImpl extends WrapperImpl implements ManagedDatabaseSecurityAlertPolicies { + private final SqlManager manager; + + ManagedDatabaseSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().managedDatabaseSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl define(String name) { + return wrapModel(name); + } + + private ManagedDatabaseSecurityAlertPolicyImpl wrapModel(ManagedDatabaseSecurityAlertPolicyInner inner) { + return new ManagedDatabaseSecurityAlertPolicyImpl(inner, manager()); + } + + private ManagedDatabaseSecurityAlertPolicyImpl wrapModel(String name) { + return new ManagedDatabaseSecurityAlertPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public ManagedDatabaseSecurityAlertPolicy call(ManagedDatabaseSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java new file mode 100644 index 0000000000000..84c2a07d63306 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseSecurityAlertPolicies. + */ +public class ManagedDatabaseSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed 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 ManagedDatabaseSecurityAlertPolicyInner object if successful. + */ + public ManagedDatabaseSecurityAlertPolicyInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed 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 managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets a managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedDatabaseSecurityAlertPolicyInner>() { + @Override + public ManagedDatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner 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 securityAlertPolicyName = "default"; + return service.get(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed 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 ManagedDatabaseSecurityAlertPolicyInner object if successful. + */ + public ManagedDatabaseSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed 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 managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed 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 ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseSecurityAlertPolicyInner>() { + @Override + public ManagedDatabaseSecurityAlertPolicyInner 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed 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 ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner 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 securityAlertPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..28ea47bef2cba --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; + +class ManagedDatabaseSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ManagedDatabaseSecurityAlertPolicy, ManagedDatabaseSecurityAlertPolicy.Definition, ManagedDatabaseSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + ManagedDatabaseSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedDatabaseSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ManagedDatabaseSecurityAlertPolicyImpl(ManagedDatabaseSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, 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 ManagedDatabaseSecurityAlertPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..40a8bf5e3075d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,226 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_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 managed database security alert policy. + */ +@JsonFlatten +public class ManagedDatabaseSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled. + * 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. 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. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner 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 ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner 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 ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner 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 ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner 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 ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner 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 ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner 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 ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..3eee0e8fa9724 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicy; + +class ManagedServerSecurityAlertPoliciesImpl extends WrapperImpl implements ManagedServerSecurityAlertPolicies { + private final SqlManager manager; + + ManagedServerSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().managedServerSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl defineSecurityAlertPolicy(String name) { + return wrapSecurityAlertPolicyModel(name); + } + + private ManagedServerSecurityAlertPolicyImpl wrapSecurityAlertPolicyModel(String name) { + return new ManagedServerSecurityAlertPolicyImpl(name, this.manager()); + } + + private ManagedServerSecurityAlertPolicyImpl wrapManagedServerSecurityAlertPolicyModel(ManagedServerSecurityAlertPolicyInner inner) { + return new ManagedServerSecurityAlertPolicyImpl(inner, manager()); + } + + private Observable getManagedServerSecurityAlertPolicyInnerUsingManagedServerSecurityAlertPoliciesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + ManagedServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + ManagedServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedServerSecurityAlertPolicy call(ManagedServerSecurityAlertPolicyInner inner) { + return wrapManagedServerSecurityAlertPolicyModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java new file mode 100644 index 0000000000000..04fcb94bf3f77 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.v2017_03_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 com.microsoft.rest.Validator; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedServerSecurityAlertPolicies. + */ +public class ManagedServerSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedServerSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedServerSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedServerSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedServerSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServerSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedServerSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.v2017_03_01_preview.ManagedServerSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedServerSecurityAlertPolicyInner 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.v2017_03_01_preview.ManagedServerSecurityAlertPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedServerSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get a managed server's threat detection 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. + * @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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner get(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Get a managed server's threat detection 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 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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Get a managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String securityAlertPolicyName = "Default"; + return service.get(resourceGroupName, managedInstanceName, 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 threat detection 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 parameters The managed server 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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server 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 managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner 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); + final String securityAlertPolicyName = "Default"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, securityAlertPolicyName, 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 threat detection 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 parameters The managed server 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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server 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 beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner 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); + final String securityAlertPolicyName = "Default"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, 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 = 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..64d7bec674bae --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java @@ -0,0 +1,177 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; + +class ManagedServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ManagedServerSecurityAlertPolicy, ManagedServerSecurityAlertPolicy.Definition, ManagedServerSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + + ManagedServerSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedServerSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.managedInstanceName = name; + // + } + + ManagedServerSecurityAlertPolicyImpl(ManagedServerSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.managedInstanceName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName); + } + + @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 ManagedServerSecurityAlertPolicyImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..66562b4b989a0 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java @@ -0,0 +1,226 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_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 managed server security alert policy. + */ +@JsonFlatten +public class ManagedServerSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled. + * 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. 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. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner 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 ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner 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 ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner 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 ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner 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 ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner 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 ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner 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 ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java index ffda6000b3e85..b8776a73fe87c 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java @@ -13,6 +13,7 @@ import rx.Observable; import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; import java.util.List; +import org.joda.time.DateTime; class ServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { private final SqlManager manager; @@ -69,6 +70,11 @@ public boolean isInCreateMode() { } + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + @Override public List disabledAlerts() { return this.inner().disabledAlerts(); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java index 2441ffcb32c1c..378b5739a87a0 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.sql.v2017_03_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; @@ -67,6 +68,12 @@ public class ServerSecurityAlertPolicyInner extends ProxyResource { @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. Possible values include: 'New', 'Enabled', 'Disabled'. * @@ -207,4 +214,13 @@ public ServerSecurityAlertPolicyInner withRetentionDays(Integer 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java index 8805ab4bf344d..f0fdd0ef1571d 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java @@ -470,6 +470,32 @@ public ServerSecurityAlertPoliciesInner serverSecurityAlertPolicies() { return this.serverSecurityAlertPolicies; } + /** + * The ManagedDatabaseSecurityAlertPoliciesInner object to access its operations. + */ + private ManagedDatabaseSecurityAlertPoliciesInner managedDatabaseSecurityAlertPolicies; + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesInner object to access its operations. + * @return the ManagedDatabaseSecurityAlertPoliciesInner object. + */ + public ManagedDatabaseSecurityAlertPoliciesInner managedDatabaseSecurityAlertPolicies() { + return this.managedDatabaseSecurityAlertPolicies; + } + + /** + * The ManagedServerSecurityAlertPoliciesInner object to access its operations. + */ + private ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicies; + + /** + * Gets the ManagedServerSecurityAlertPoliciesInner object to access its operations. + * @return the ManagedServerSecurityAlertPoliciesInner object. + */ + public ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicies() { + return this.managedServerSecurityAlertPolicies; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -531,6 +557,8 @@ protected void initialize() { this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java index 17ec28e13069e..0a09877ffea8e 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java @@ -42,6 +42,8 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTunings; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -75,6 +77,8 @@ public final class SqlManager extends ManagerCore Date: Mon, 17 Dec 2018 11:30:08 -0800 Subject: [PATCH 11/17] Generated from 59e8d0868a5c15631fdaaa7806897f22f4872fef (#2801) typo: sql/resource-manager/Microsoft.Sql - recoverabel -> recoverable --- .../management/sql/v2014_04_01/Databases.java | 4 ++-- .../sql/v2014_04_01/RecommendedElasticPools.java | 4 ++-- .../v2014_04_01/ServerTableAuditingPolicies.java | 2 +- .../implementation/DatabasesInner.java | 16 ++++++++-------- .../implementation/MetricDefinitionInner.java | 4 ++-- .../RecommendedElasticPoolInner.java | 2 +- .../RecommendedElasticPoolsInner.java | 16 ++++++++-------- .../ServerTableAuditingPoliciesInner.java | 16 ++++++++-------- .../RecommendedActionStateInfo.java | 10 +++++----- .../implementation/AdvisorInner.java | 8 ++++---- .../sql/v2017_03_01_preview/JobSchedule.java | 6 +++--- .../implementation/JobExecutionsInner.java | 16 ++++++++-------- 12 files changed, 52 insertions(+), 52 deletions(-) diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java index 49215e0a17a2d..525e6ed65571e 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java @@ -73,7 +73,7 @@ public interface Databases extends SupportsCreating listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); /** - * Gets a database inside of a recommented elastic pool. + * Gets a database inside of a recommended 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. @@ -85,7 +85,7 @@ public interface Databases extends SupportsCreating getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName); /** - * Returns a list of databases inside a recommented elastic pool. + * Returns a list of databases inside a recommended 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. diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java index cc8cc11b6c8c2..261e853a53b73 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java @@ -18,7 +18,7 @@ */ public interface RecommendedElasticPools extends HasInner { /** - * Gets a recommented elastic pool. + * Gets a recommended 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. @@ -39,7 +39,7 @@ public interface RecommendedElasticPools extends HasInner listByServerAsync(String resourceGroupName, String serverName); /** - * Returns recommented elastic pool metrics. + * Returns recommended elastic pool 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 serverName The name of the server. diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java index 9570848fe18cf..b2277c59ac26a 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServerTableAuditingPolicies.java @@ -18,7 +18,7 @@ */ public interface ServerTableAuditingPolicies extends SupportsCreating, HasInner { /** - * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * Lists a server's table auditing policies. Table auditing is deprecated, use blob auditing instead. * * @param resourceGroupName The 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. diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java index c19c32fdf93c1..010c7e069f4ae 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java @@ -1526,7 +1526,7 @@ private ServiceResponse> listByElasticPoolDelegate(Respo } /** - * Gets a database inside of a recommented elastic pool. + * Gets a database inside of a recommended 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. @@ -1542,7 +1542,7 @@ public DatabaseInner getByRecommendedElasticPool(String resourceGroupName, Strin } /** - * Gets a database inside of a recommented elastic pool. + * Gets a database inside of a recommended 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. @@ -1557,7 +1557,7 @@ public ServiceFuture getByRecommendedElasticPoolAsync(String reso } /** - * Gets a database inside of a recommented elastic pool. + * Gets a database inside of a recommended 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. @@ -1576,7 +1576,7 @@ public DatabaseInner call(ServiceResponse response) { } /** - * Gets a database inside of a recommented elastic pool. + * Gets a database inside of a recommended 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. @@ -1626,7 +1626,7 @@ private ServiceResponse getByRecommendedElasticPoolDelegate(Respo } /** - * Returns a list of databases inside a recommented elastic pool. + * Returns a list of databases inside a recommended 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. @@ -1641,7 +1641,7 @@ public List listByRecommendedElasticPool(String resourceGroupName } /** - * Returns a list of databases inside a recommented elastic pool. + * Returns a list of databases inside a recommended 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. @@ -1655,7 +1655,7 @@ public ServiceFuture> listByRecommendedElasticPoolAsync(Stri } /** - * Returns a list of databases inside a recommented elastic pool. + * Returns a list of databases inside a recommended 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. @@ -1673,7 +1673,7 @@ public List call(ServiceResponse> response) { } /** - * Returns a list of databases inside a recommented elastic pool. + * Returns a list of databases inside a recommended 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. diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java index 4a10b9bde796d..dd7e636fc1aea 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/MetricDefinitionInner.java @@ -47,7 +47,7 @@ public class MetricDefinitionInner { private UnitDefinitionType unit; /** - * The list of database metric availabities for the metric. + * The list of database metric availabilities for the metric. */ @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) private List metricAvailabilities; @@ -89,7 +89,7 @@ public UnitDefinitionType unit() { } /** - * Get the list of database metric availabities for the metric. + * Get the list of database metric availabilities for the metric. * * @return the metricAvailabilities value */ diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java index 4f9e68cc60c45..d1325b66bb072 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java @@ -16,7 +16,7 @@ import com.microsoft.azure.ProxyResource; /** - * Represents a recommented elastic pool. + * Represents a recommended elastic pool. */ @JsonFlatten public class RecommendedElasticPoolInner extends ProxyResource { diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java index e5c6cca5a3293..1f044b5cdaa21 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java @@ -67,7 +67,7 @@ interface RecommendedElasticPoolsService { } /** - * Gets a recommented elastic pool. + * Gets a recommended 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. @@ -82,7 +82,7 @@ public RecommendedElasticPoolInner get(String resourceGroupName, String serverNa } /** - * Gets a recommented elastic pool. + * Gets a recommended 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. @@ -96,7 +96,7 @@ public ServiceFuture getAsync(String resourceGroupN } /** - * Gets a recommented elastic pool. + * Gets a recommended 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. @@ -114,7 +114,7 @@ public RecommendedElasticPoolInner call(ServiceResponse> listByServerDeleg } /** - * Returns recommented elastic pool metrics. + * Returns recommended elastic pool 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 serverName The name of the server. @@ -266,7 +266,7 @@ public List listMetrics(String resourceGroupN } /** - * Returns recommented elastic pool metrics. + * Returns recommended elastic pool 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 serverName The name of the server. @@ -280,7 +280,7 @@ public ServiceFuture> listMetricsAsync(S } /** - * Returns recommented elastic pool metrics. + * Returns recommended elastic pool 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 serverName The name of the server. @@ -298,7 +298,7 @@ public List call(ServiceResponse getDelegate(Response createOrUpdateAsync(String } /** - * Creates or updates a servers's table auditing policy. Table auditing is deprecated, use blob auditing instead. + * Creates or updates a server's table auditing policy. Table auditing is deprecated, use blob auditing instead. * * @param resourceGroupName The 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. @@ -203,7 +203,7 @@ public ServerTableAuditingPolicyInner call(ServiceResponse createOrUpdateDelegate(R } /** - * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * Lists a server's table auditing policies. Table auditing is deprecated, use blob auditing instead. * * @param resourceGroupName The 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. @@ -266,7 +266,7 @@ public ServerTableAuditingPolicyListResultInner listByServer(String resourceGrou } /** - * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * Lists a server's table auditing policies. Table auditing is deprecated, use blob auditing instead. * * @param resourceGroupName The 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. @@ -279,7 +279,7 @@ public ServiceFuture listByServerAsync } /** - * Lists a servers's table auditing policies. Table auditing is deprecated, use blob auditing instead. + * Lists a server's table auditing policies. Table auditing is deprecated, use blob auditing instead. * * @param resourceGroupName The 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. @@ -296,7 +296,7 @@ public ServerTableAuditingPolicyListResultInner call(ServiceResponse getDelegate(Response re } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. @@ -1128,7 +1128,7 @@ public JobExecutionInner createOrUpdate(String resourceGroupName, String serverN } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. @@ -1144,7 +1144,7 @@ public ServiceFuture createOrUpdateAsync(String resourceGroup } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. @@ -1164,7 +1164,7 @@ public JobExecutionInner call(ServiceResponse response) { } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. @@ -1201,7 +1201,7 @@ public Observable> createOrUpdateWithServiceR } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. @@ -1218,7 +1218,7 @@ public JobExecutionInner beginCreateOrUpdate(String resourceGroupName, String se } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. @@ -1234,7 +1234,7 @@ public ServiceFuture beginCreateOrUpdateAsync(String resource } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. @@ -1254,7 +1254,7 @@ public JobExecutionInner call(ServiceResponse response) { } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The 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. From 5d2480149059f756d7867e9c7041869966b0c313 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 11 Jan 2019 11:37:25 -0800 Subject: [PATCH 12/17] Generated from d82d1491879729cdf44da9a664e815112acde158 (#2836) Fix set LTR policy example --- .../LongTermRetentionBackups.java | 14 +-- .../LongTermRetentionBackupsInner.java | 108 +++++++++--------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java index 8a63b778727a8..93c595a233d3b 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java @@ -30,7 +30,7 @@ public interface LongTermRetentionBackups extends HasInner getAsync(String locationName, * Gets a long term retention backup. * * @param locationName The location of the database. - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the LongTermRetentionBackupInner object @@ -151,8 +151,8 @@ public LongTermRetentionBackupInner call(ServiceResponse getDelegate(Response deleteAsync(String locationName, String longTermReten * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -250,8 +250,8 @@ public Void call(ServiceResponse response) { * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -283,8 +283,8 @@ public Observable> deleteWithServiceResponseAsync(String l * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -298,8 +298,8 @@ public void beginDelete(String locationName, String longTermRetentionServerName, * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the 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 @@ -313,8 +313,8 @@ public ServiceFuture beginDeleteAsync(String locationName, String longTerm * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -332,8 +332,8 @@ public Void call(ServiceResponse response) { * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -383,8 +383,8 @@ private ServiceResponse beginDeleteDelegate(Response respons * Lists all long term retention backups for a database. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName 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 @@ -404,8 +404,8 @@ public Page nextPage(String nextPageLink) { * Lists all long term retention backups for a database. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName 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 @@ -426,8 +426,8 @@ public Observable>> call(Stri * Lists all long term retention backups for a database. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ @@ -445,8 +445,8 @@ public Page call(ServiceResponse>> call(Serv * Lists all long term retention backups for a database. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -509,8 +509,8 @@ public Observable>> call(Resp * Lists all long term retention backups for a database. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name 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 @@ -532,8 +532,8 @@ public Page nextPage(String nextPageLink) { * Lists all long term retention backups for a database. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name 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. @@ -556,8 +556,8 @@ public Observable>> call(Stri * Lists all long term retention backups for a database. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name 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 @@ -577,8 +577,8 @@ public Page call(ServiceResponse>> call(Serv * Lists all long term retention backups for a database. * ServiceResponse> * @param locationName The location of the database - ServiceResponse> * @param longTermRetentionServerName the String value - ServiceResponse> * @param longTermRetentionDatabaseName the String value + ServiceResponse> * @param longTermRetentionServerName The name of the server + ServiceResponse> * @param longTermRetentionDatabaseName The name 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 @@ -885,7 +885,7 @@ private ServiceResponse> listByLocationDe * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName 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 @@ -905,7 +905,7 @@ public Page nextPage(String nextPageLink) { * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName 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 @@ -926,7 +926,7 @@ public Observable>> call(Stri * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ @@ -944,7 +944,7 @@ public Page call(ServiceResponse>> call(Serv * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1003,7 +1003,7 @@ public Observable>> call(Resp * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @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 @@ -1025,7 +1025,7 @@ public Page nextPage(String nextPageLink) { * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @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. @@ -1048,7 +1048,7 @@ public Observable>> call(Stri * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @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 @@ -1068,7 +1068,7 @@ public Page call(ServiceResponse>> call(Serv * Lists the long term retention backups for a given server. * ServiceResponse> * @param locationName The location of the database - ServiceResponse> * @param longTermRetentionServerName the String value + ServiceResponse> * @param longTermRetentionServerName The name of the server 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 From 08fec10cf0fe156bbafbae29641df592a63dd08d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 18 Jan 2019 09:09:51 -0800 Subject: [PATCH 13/17] [AutoPR sql/resource-manager] Added support for dropped databases on Managed Instance (#2811) * Generated from b69193acc6a531e053151c7ba4aaffb07cb218a0 Added support for dropped databases on Managed Instance * Generated from 676178334abdb40ac47516783d789272008e8488 Adding support for dropped databases on Managed Instance --- ...ManagedBackupShortTermRetentionPolicy.java | 90 ++ ...nagedBackupShortTermRetentionPolicies.java | 6 +- ...abaseBackupShortTermRetentionPolicies.java | 42 + ...ManagedBackupShortTermRetentionPolicy.java | 90 ++ .../RestorableDroppedManagedDatabase.java | 69 + .../RestorableDroppedManagedDatabases.java | 39 + ...gedBackupShortTermRetentionPolicyImpl.java | 100 ++ ...dBackupShortTermRetentionPoliciesImpl.java | 24 +- ...eBackupShortTermRetentionPoliciesImpl.java | 74 ++ ...BackupShortTermRetentionPoliciesInner.java | 1135 +++++++++++++++++ ...gedBackupShortTermRetentionPolicyImpl.java | 100 ++ .../RestorableDroppedManagedDatabaseImpl.java | 89 ++ ...RestorableDroppedManagedDatabaseInner.java | 81 ++ ...RestorableDroppedManagedDatabasesImpl.java | 73 ++ ...estorableDroppedManagedDatabasesInner.java | 401 ++++++ .../SqlManagementClientImpl.java | 28 + .../implementation/SqlManager.java | 24 + 17 files changed, 2450 insertions(+), 15 deletions(-) create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabase.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabases.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesInner.java diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..29905c46f7f2e --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedBackupShortTermRetentionPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy. + */ +public interface DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasismanagedinstancemanagedbackupshorttermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * 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 { + } + } + /** + * The template for a DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java index 03caf7827e711..d688cbdf5c327 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java @@ -16,7 +16,7 @@ /** * Type representing ManagedBackupShortTermRetentionPolicies. */ -public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreating, HasInner { +public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreating, HasInner { /** * Gets a managed database's short term retention policy. * @@ -26,7 +26,7 @@ public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreatin * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); /** * Gets a managed database's short term retention policy list. @@ -37,6 +37,6 @@ public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreatin * @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); + Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName); } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..00b172538fad5 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. + */ +public interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a dropped database's short 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..436c4b6402e93 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedBackupShortTermRetentionPolicyInner; +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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy. + */ +public interface RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRestorableDroppedDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithRestorableDroppedDatabasis { + } + + /** + * The stage of the restorabledroppeddatabasismanagedinstancemanagedbackupshorttermretentionpolicy definition allowing to specify RestorableDroppedDatabasis. + */ + interface WithRestorableDroppedDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, restorableDroppedDatabaseId. + */ + WithCreate withExistingRestorableDroppedDatabasis(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + } + + /** + * 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 { + } + } + /** + * The template for a RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabase.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabase.java new file mode 100644 index 0000000000000..d08e30ec738c3 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabase.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.RestorableDroppedManagedDatabaseInner; +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.v2017_03_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing RestorableDroppedManagedDatabase. + */ +public interface RestorableDroppedManagedDatabase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the deletionDate value. + */ + DateTime deletionDate(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabases.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabases.java new file mode 100644 index 0000000000000..0926d20816deb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabases.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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabase; + +/** + * Type representing RestorableDroppedManagedDatabases. + */ +public interface RestorableDroppedManagedDatabases { + /** + * Gets a restorable dropped 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a list of restorable dropped 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); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..9dc568bb8d6ef --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy, DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Definition, DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedBackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(ManagedBackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + 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() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + 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 name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java index 55d69142e4744..cf0a72b2ca3a0 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java @@ -14,7 +14,7 @@ import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.Page; -import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; class ManagedBackupShortTermRetentionPoliciesImpl extends WrapperImpl implements ManagedBackupShortTermRetentionPolicies { private final SqlManager manager; @@ -29,20 +29,20 @@ public SqlManager manager() { } @Override - public ManagedBackupShortTermRetentionPolicyImpl define(String name) { + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl define(String name) { return wrapModel(name); } - private ManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { - return new ManagedBackupShortTermRetentionPolicyImpl(inner, manager()); + private DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { + return new DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(inner, manager()); } - private ManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { - return new ManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + private DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); } @Override - public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { ManagedBackupShortTermRetentionPoliciesInner client = this.inner(); return client.listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName) .flatMapIterable(new Func1, Iterable>() { @@ -51,21 +51,21 @@ public Iterable call(Page() { + .map(new Func1() { @Override - public ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { return wrapModel(inner); } }); } @Override - public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { ManagedBackupShortTermRetentionPoliciesInner client = this.inner(); return client.getAsync(resourceGroupName, managedInstanceName, databaseName) - .map(new Func1() { + .map(new Func1() { @Override - public ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { return wrapModel(inner); } }); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..38e3c577867ba --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; + +class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl extends WrapperImpl implements ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { + private final SqlManager manager; + + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { + return new RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(inner, manager()); + } + + private RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.inner(); + return client.listByRestorableDroppedDatabaseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .map(new Func1() { + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..94498c7b4c6fb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner.java @@ -0,0 +1,1135 @@ +/** + * 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.v2017_03_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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. + */ +public class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @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.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies listByRestorableDroppedDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies") + Observable> listByRestorableDroppedDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @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.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies listByRestorableDroppedDatabaseNext" }) + @GET + Observable> listByRestorableDroppedDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a dropped database's short 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 restorableDroppedDatabaseId 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 + * @return the ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner get(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single().body(); + } + + /** + * Gets a dropped database's short 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 restorableDroppedDatabaseId 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 getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Gets a dropped database's short 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a dropped database's short 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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, restorableDroppedDatabaseId, 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 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 restorableDroppedDatabaseId 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 + * @return the ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().last().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId 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 createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).toBlocking().last().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets 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 restorableDroppedDatabaseId 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 + * @return the ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId 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 beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).toBlocking().single().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, 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 = 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); + } + + /** + * Sets 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 restorableDroppedDatabaseId 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 + * @return the ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().last().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId 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 updateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).toBlocking().last().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets 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 restorableDroppedDatabaseId 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 + * @return the ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId 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 beginUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, 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); + } + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).toBlocking().single().body(); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), serviceCallback); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets 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 restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, 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 dropped database's short term retention policy list. + * + * @param resourceGroupName The 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 restorableDroppedDatabaseId 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 + * @return the PagedList<ManagedBackupShortTermRetentionPolicyInner> object if successful. + */ + public PagedList listByRestorableDroppedDatabase(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + ServiceResponse> response = listByRestorableDroppedDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The 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 restorableDroppedDatabaseId 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> listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByRestorableDroppedDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable> listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + return listByRestorableDroppedDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable>> listByRestorableDroppedDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + return listByRestorableDroppedDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .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(listByRestorableDroppedDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedBackupShortTermRetentionPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByRestorableDroppedDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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.listByRestorableDroppedDatabase(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, 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 = listByRestorableDroppedDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByRestorableDroppedDatabaseDelegate(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 dropped database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> object if successful. + */ + public PagedList listByRestorableDroppedDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @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> listByRestorableDroppedDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable> listByRestorableDroppedDatabaseNextAsync(final String nextPageLink) { + return listByRestorableDroppedDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable>> listByRestorableDroppedDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(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(listByRestorableDroppedDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedBackupShortTermRetentionPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByRestorableDroppedDatabaseNextSinglePageAsync(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.listByRestorableDroppedDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByRestorableDroppedDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByRestorableDroppedDatabaseNextDelegate(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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..cc596c500883d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy, RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Definition, RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String restorableDroppedDatabaseId; + + RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedBackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.restorableDroppedDatabaseId = name; + // + } + + RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(ManagedBackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.restorableDroppedDatabaseId = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.restorableDroppedDatabaseId = IdParsingUtils.getValueFromIdByName(inner.id(), "restorableDroppedDatabases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId); + } + + @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 Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl withExistingRestorableDroppedDatabasis(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseImpl.java new file mode 100644 index 0000000000000..ed54b6bbf916b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.Map; + +class RestorableDroppedManagedDatabaseImpl extends IndexableRefreshableWrapperImpl implements RestorableDroppedManagedDatabase { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String restorableDroppedDatabaseId; + + RestorableDroppedManagedDatabaseImpl(RestorableDroppedManagedDatabaseInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.restorableDroppedDatabaseId = IdParsingUtils.getValueFromIdByName(inner.id(), "restorableDroppedDatabases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RestorableDroppedManagedDatabasesInner client = this.manager().inner().restorableDroppedManagedDatabases(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId); + } + + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public DateTime deletionDate() { + return this.inner().deletionDate(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseInner.java new file mode 100644 index 0000000000000..0ab7503467f75 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseInner.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A restorable dropped managed database resource. + */ +@JsonFlatten +public class RestorableDroppedManagedDatabaseInner extends Resource { + /** + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deletionDate; + + /** + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Get the name of the database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletion date of the database (ISO8601 format). + * + * @return the deletionDate value + */ + public DateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesImpl.java new file mode 100644 index 0000000000000..d46ff79224904 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesImpl.java @@ -0,0 +1,73 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabases; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabase; +import com.microsoft.azure.Page; + +class RestorableDroppedManagedDatabasesImpl extends WrapperImpl implements RestorableDroppedManagedDatabases { + private final SqlManager manager; + + RestorableDroppedManagedDatabasesImpl(SqlManager manager) { + super(manager.inner().restorableDroppedManagedDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RestorableDroppedManagedDatabaseImpl wrapRestorableDroppedManagedDatabaseModel(RestorableDroppedManagedDatabaseInner inner) { + return new RestorableDroppedManagedDatabaseImpl(inner, manager()); + } + + private Observable getRestorableDroppedManagedDatabaseInnerUsingRestorableDroppedManagedDatabasesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String restorableDroppedDatabaseId = IdParsingUtils.getValueFromIdByName(id, "restorableDroppedDatabases"); + RestorableDroppedManagedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + RestorableDroppedManagedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .map(new Func1() { + @Override + public RestorableDroppedManagedDatabase call(RestorableDroppedManagedDatabaseInner inner) { + return wrapRestorableDroppedManagedDatabaseModel(inner); + } + }); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + RestorableDroppedManagedDatabasesInner 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 RestorableDroppedManagedDatabase call(RestorableDroppedManagedDatabaseInner inner) { + return wrapRestorableDroppedManagedDatabaseModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesInner.java new file mode 100644 index 0000000000000..3ec919754da33 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesInner.java @@ -0,0 +1,401 @@ +/** + * 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.v2017_03_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 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 RestorableDroppedManagedDatabases. + */ +public class RestorableDroppedManagedDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private RestorableDroppedManagedDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedManagedDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RestorableDroppedManagedDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RestorableDroppedManagedDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RestorableDroppedManagedDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface RestorableDroppedManagedDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabases listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases") + 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.v2017_03_01_preview.RestorableDroppedManagedDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @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.v2017_03_01_preview.RestorableDroppedManagedDatabases listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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 restorable dropped 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 restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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 restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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 restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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 restorable dropped 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 restorableDroppedDatabaseId 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 + * @return the RestorableDroppedManagedDatabaseInner object if successful. + */ + public RestorableDroppedManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single().body(); + } + + /** + * Gets a restorable dropped 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 restorableDroppedDatabaseId 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 getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Gets a restorable dropped 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedManagedDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, RestorableDroppedManagedDatabaseInner>() { + @Override + public RestorableDroppedManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a restorable dropped 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 restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedManagedDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + 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 (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId 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, restorableDroppedDatabaseId, 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 restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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 restorable dropped 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 restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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 restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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 restorable dropped 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<RestorableDroppedManagedDatabaseInner> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java index f0fdd0ef1571d..3e441c6be62ca 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java @@ -418,6 +418,32 @@ public ManagedDatabasesInner managedDatabases() { return this.managedDatabases; } + /** + * The ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner object to access its operations. + */ + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner object to access its operations. + * @return the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner object. + */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() { + return this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + } + + /** + * The RestorableDroppedManagedDatabasesInner object to access its operations. + */ + private RestorableDroppedManagedDatabasesInner restorableDroppedManagedDatabases; + + /** + * Gets the RestorableDroppedManagedDatabasesInner object to access its operations. + * @return the RestorableDroppedManagedDatabasesInner object. + */ + public RestorableDroppedManagedDatabasesInner restorableDroppedManagedDatabases() { + return this.restorableDroppedManagedDatabases; + } + /** * The RestorePointsInner object to access its operations. */ @@ -553,6 +579,8 @@ protected void initialize() { this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); + this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); + this.restorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesInner(restClient().retrofit(), this); this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java index 0a09877ffea8e..d14cd0893ed9b 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java @@ -38,6 +38,8 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.BackupLongTermRetentionPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabases; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabases; import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoints; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTunings; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases; @@ -73,6 +75,8 @@ public final class SqlManager extends ManagerCore Date: Tue, 22 Jan 2019 10:58:26 -0800 Subject: [PATCH 14/17] [AutoPR sql/resource-manager] Managed Instance GeoRestore Cmds (#2825) * Generated from 6bb8cd671fb641dad3af4d4b557d6230c99237af Modify example files and readme.md Modify example files and readme.md for get recoverable managed databases * Generated from 6bb8cd671fb641dad3af4d4b557d6230c99237af Modify example files and readme.md Modify example files and readme.md for get recoverable managed databases * Generated from 056912d8e7565bffe7b39979ad9e6e2d69a69014 Update recoverableManagedDatabaseName to recoverableDatabaseName Update recoverableManagedDatabaseName to recoverableDatabaseName --- .../RecoverableManagedDatabase.java | 42 ++ .../RecoverableManagedDatabases.java | 40 ++ .../RecoverableManagedDatabaseImpl.java | 62 +++ .../RecoverableManagedDatabaseInner.java | 35 ++ .../RecoverableManagedDatabasesImpl.java | 65 +++ .../RecoverableManagedDatabasesInner.java | 401 ++++++++++++++++++ .../SqlManagementClientImpl.java | 14 + .../implementation/SqlManager.java | 12 + 8 files changed, 671 insertions(+) create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabase.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabases.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesInner.java diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabase.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabase.java new file mode 100644 index 0000000000000..eca31ea913046 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabase.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.v2017_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.RecoverableManagedDatabaseInner; +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.v2017_10_01_preview.implementation.SqlManager; + +/** + * Type representing RecoverableManagedDatabase. + */ +public interface RecoverableManagedDatabase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastAvailableBackupDate value. + */ + String lastAvailableBackupDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabases.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabases.java new file mode 100644 index 0000000000000..c73338b1d549a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/RecoverableManagedDatabases.java @@ -0,0 +1,40 @@ +/** + * 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.v2017_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.RecoverableManagedDatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecoverableManagedDatabases. + */ +public interface RecoverableManagedDatabases extends HasInner { + /** + * Gets a recoverable 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 recoverableDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String recoverableDatabaseName); + + /** + * Gets a list of recoverable 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); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseImpl.java new file mode 100644 index 0000000000000..4751c5fa7cf0c --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.RecoverableManagedDatabase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class RecoverableManagedDatabaseImpl extends IndexableRefreshableWrapperImpl implements RecoverableManagedDatabase { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String recoverableDatabaseName; + + RecoverableManagedDatabaseImpl(RecoverableManagedDatabaseInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.recoverableDatabaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "recoverableDatabases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecoverableManagedDatabasesInner client = this.manager().inner().recoverableManagedDatabases(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.recoverableDatabaseName); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastAvailableBackupDate() { + return this.inner().lastAvailableBackupDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseInner.java new file mode 100644 index 0000000000000..08d0cf8784a10 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabaseInner.java @@ -0,0 +1,35 @@ +/** + * 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.v2017_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A recoverable managed database resource. + */ +@JsonFlatten +public class RecoverableManagedDatabaseInner extends ProxyResource { + /** + * The last available backup date. + */ + @JsonProperty(value = "properties.lastAvailableBackupDate", access = JsonProperty.Access.WRITE_ONLY) + private String lastAvailableBackupDate; + + /** + * Get the last available backup date. + * + * @return the lastAvailableBackupDate value + */ + public String lastAvailableBackupDate() { + return this.lastAvailableBackupDate; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesImpl.java new file mode 100644 index 0000000000000..119953c77ec69 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesImpl.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.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.RecoverableManagedDatabases; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.RecoverableManagedDatabase; + +class RecoverableManagedDatabasesImpl extends WrapperImpl implements RecoverableManagedDatabases { + private final SqlManager manager; + + RecoverableManagedDatabasesImpl(SqlManager manager) { + super(manager.inner().recoverableManagedDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RecoverableManagedDatabaseImpl wrapModel(RecoverableManagedDatabaseInner inner) { + return new RecoverableManagedDatabaseImpl(inner, manager()); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + RecoverableManagedDatabasesInner 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 RecoverableManagedDatabase call(RecoverableManagedDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + RecoverableManagedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName) + .map(new Func1() { + @Override + public RecoverableManagedDatabase call(RecoverableManagedDatabaseInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesInner.java new file mode 100644 index 0000000000000..741eb5979e229 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/RecoverableManagedDatabasesInner.java @@ -0,0 +1,401 @@ +/** + * 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.v2017_10_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 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 RecoverableManagedDatabases. + */ +public class RecoverableManagedDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private RecoverableManagedDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableManagedDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecoverableManagedDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecoverableManagedDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecoverableManagedDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface RecoverableManagedDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.RecoverableManagedDatabases listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/recoverableDatabases") + 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.v2017_10_01_preview.RecoverableManagedDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("recoverableDatabaseName") String recoverableDatabaseName, @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.v2017_10_01_preview.RecoverableManagedDatabases listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of recoverable 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<RecoverableManagedDatabaseInner> 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 recoverable 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 recoverable 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<RecoverableManagedDatabaseInner> 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 recoverable 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<RecoverableManagedDatabaseInner> 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 recoverable 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<RecoverableManagedDatabaseInner> 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 recoverable 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 recoverableDatabaseName 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 + * @return the RecoverableManagedDatabaseInner object if successful. + */ + public RecoverableManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName).toBlocking().single().body(); + } + + /** + * Gets a recoverable 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 recoverableDatabaseName 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 getAsync(String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName), serviceCallback); + } + + /** + * Gets a recoverable 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 recoverableDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecoverableManagedDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName).map(new Func1, RecoverableManagedDatabaseInner>() { + @Override + public RecoverableManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a recoverable 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 recoverableDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecoverableManagedDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + 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 (recoverableDatabaseName == null) { + throw new IllegalArgumentException("Parameter recoverableDatabaseName 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, recoverableDatabaseName, 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 recoverable 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<RecoverableManagedDatabaseInner> 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 recoverable 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 recoverable 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<RecoverableManagedDatabaseInner> 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 recoverable 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<RecoverableManagedDatabaseInner> 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 recoverable 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<RecoverableManagedDatabaseInner> 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/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java index 0ea31b9c9e0e8..403ee6c9bf50d 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java @@ -327,6 +327,19 @@ public ManagedInstanceEncryptionProtectorsInner managedInstanceEncryptionProtect return this.managedInstanceEncryptionProtectors; } + /** + * The RecoverableManagedDatabasesInner object to access its operations. + */ + private RecoverableManagedDatabasesInner recoverableManagedDatabases; + + /** + * Gets the RecoverableManagedDatabasesInner object to access its operations. + * @return the RecoverableManagedDatabasesInner object. + */ + public RecoverableManagedDatabasesInner recoverableManagedDatabases() { + return this.recoverableManagedDatabases; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -377,6 +390,7 @@ protected void initialize() { this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesInner(restClient().retrofit(), this); this.managedInstanceKeys = new ManagedInstanceKeysInner(restClient().retrofit(), this); this.managedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsInner(restClient().retrofit(), this); + this.recoverableManagedDatabases = new RecoverableManagedDatabasesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java index f76a2962112b5..aeddeb2596b2a 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java @@ -31,6 +31,7 @@ import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates; import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceKeys; import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors; +import com.microsoft.azure.management.sql.v2017_10_01_preview.RecoverableManagedDatabases; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -53,6 +54,7 @@ public final class SqlManager extends ManagerCore Date: Wed, 30 Jan 2019 06:59:09 -0800 Subject: [PATCH 15/17] Generated from 45f508a8851c33aa3d6e6901127de68e75ed596d (#2890) Update managedInstances.json Adding two new ManagedInstance properties --- .../v2015_05_01_preview/ManagedInstance.java | 54 ++++++++++++++++++- .../ManagedInstanceUpdate.java | 52 ++++++++++++++++++ .../implementation/ManagedInstanceImpl.java | 30 +++++++++++ .../implementation/ManagedInstanceInner.java | 52 ++++++++++++++++++ 4 files changed, 186 insertions(+), 2 deletions(-) diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java index 7ac575c97308d..8a82ab1ff7c8d 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java @@ -64,6 +64,16 @@ public interface ManagedInstance extends HasInner, Resourc */ String licenseType(); + /** + * @return the proxyOverride value. + */ + String proxyOverride(); + + /** + * @return the publicDataEndpointEnabled value. + */ + Boolean publicDataEndpointEnabled(); + /** * @return the sku value. */ @@ -171,6 +181,26 @@ interface WithLicenseType { WithCreate withLicenseType(String licenseType); } + /** + * The stage of the managedinstance update allowing to specify ProxyOverride. + */ + interface WithProxyOverride { + /** + * Specifies proxyOverride. + */ + WithCreate withProxyOverride(String proxyOverride); + } + + /** + * The stage of the managedinstance update allowing to specify PublicDataEndpointEnabled. + */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies publicDataEndpointEnabled. + */ + WithCreate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + /** * The stage of the managedinstance update allowing to specify Sku. */ @@ -216,13 +246,13 @@ interface WithVCores { * 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.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithProxyOverride, DefinitionStages.WithPublicDataEndpointEnabled, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores { } } /** * The template for a ManagedInstance update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithVCores { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithProxyOverride, UpdateStages.WithPublicDataEndpointEnabled, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithVCores { } /** @@ -279,6 +309,26 @@ interface WithLicenseType { Update withLicenseType(String licenseType); } + /** + * The stage of the managedinstance {0} allowing to specify ProxyOverride. + */ + interface WithProxyOverride { + /** + * Specifies proxyOverride. + */ + Update withProxyOverride(String proxyOverride); + } + + /** + * The stage of the managedinstance {0} allowing to specify PublicDataEndpointEnabled. + */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies publicDataEndpointEnabled. + */ + Update withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + /** * The stage of the managedinstance {0} allowing to specify Sku. */ diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java index 9e4b6b717db42..72797cec11d1d 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java @@ -93,6 +93,18 @@ public class ManagedInstanceUpdate { @JsonProperty(value = "properties.dnsZonePartner") private String dnsZonePartner; + /** + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /** + * Proxy override of the managed instance. + */ + @JsonProperty(value = "properties.proxyOverride") + private String proxyOverride; + /** * Resource tags. */ @@ -306,6 +318,46 @@ public ManagedInstanceUpdate withDnsZonePartner(String 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 proxy override of the managed instance. + * + * @return the proxyOverride value + */ + public String proxyOverride() { + return this.proxyOverride; + } + + /** + * Set proxy override of the managed instance. + * + * @param proxyOverride the proxyOverride value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withProxyOverride(String proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + /** * Get resource tags. * diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java index 1500a0ca9852c..532f3862d93e4 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java @@ -106,6 +106,16 @@ public String licenseType() { return this.inner().licenseType(); } + @Override + public String proxyOverride() { + return this.inner().proxyOverride(); + } + + @Override + public Boolean publicDataEndpointEnabled() { + return this.inner().publicDataEndpointEnabled(); + } + @Override public Sku sku() { return this.inner().sku(); @@ -187,6 +197,26 @@ public ManagedInstanceImpl withLicenseType(String licenseType) { return this; } + @Override + public ManagedInstanceImpl withProxyOverride(String 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 withSku(Sku sku) { if (isInCreateMode()) { diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java index 2fc537c23f6f7..06120a103474a 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java @@ -101,6 +101,18 @@ public class ManagedInstanceInner extends Resource { @JsonProperty(value = "properties.dnsZonePartner") private String dnsZonePartner; + /** + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /** + * Proxy override of the managed instance. + */ + @JsonProperty(value = "properties.proxyOverride") + private String proxyOverride; + /** * Get the Azure Active Directory identity of the managed instance. * @@ -328,4 +340,44 @@ public ManagedInstanceInner withDnsZonePartner(String 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 proxy override of the managed instance. + * + * @return the proxyOverride value + */ + public String proxyOverride() { + return this.proxyOverride; + } + + /** + * Set proxy override of the managed instance. + * + * @param proxyOverride the proxyOverride value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withProxyOverride(String proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + } From 8d2f2cff187667425c5f286bb06c62fbd3512a27 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 6 Feb 2019 11:51:48 -0800 Subject: [PATCH 16/17] Generated from 45e35bcbc58caa5f6d38632405b8a855872b77d9 (#2920) Merge pull request #1 from anuchandy/data-classification-java-codegen Fixing java codegen --- .../DatabasisServerSensitivityLabel.java | 55 ++ .../DatabasisServerSensitivityLabelModel.java | 55 ++ .../RecommendedSensitivityLabels.java | 30 + .../v2017_03_01_preview/SensitivityLabel.java | 185 ++++ .../SensitivityLabelSource.java | 53 ++ .../SensitivityLabels.java | 62 ++ .../DatabasisServerSensitivityLabelImpl.java | 65 ++ ...abasisServerSensitivityLabelModelImpl.java | 65 ++ .../RecommendedSensitivityLabelsImpl.java | 53 ++ .../RecommendedSensitivityLabelsInner.java | 447 ++++++++++ .../implementation/SensitivityLabelImpl.java | 148 ++++ .../implementation/SensitivityLabelInner.java | 124 +++ .../implementation/SensitivityLabelsImpl.java | 86 ++ .../SensitivityLabelsInner.java | 818 ++++++++++++++++++ .../SqlManagementClientImpl.java | 28 + .../implementation/SqlManager.java | 24 + 16 files changed, 2298 insertions(+) create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java create mode 100644 sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java new file mode 100644 index 0000000000000..3edcf9a484ddd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisServerSensitivityLabel. + */ +public interface DatabasisServerSensitivityLabel extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java new file mode 100644 index 0000000000000..c0b983e85a9eb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisServerSensitivityLabelModel. + */ +public interface DatabasisServerSensitivityLabelModel extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java new file mode 100644 index 0000000000000..8781026c7a225 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.RecommendedSensitivityLabelsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecommendedSensitivityLabels. + */ +public interface RecommendedSensitivityLabels extends HasInner { + /** + * 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 serverName The name of the server. + * @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 serverName, final String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java new file mode 100644 index 0000000000000..6d4c13aaf8532 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java @@ -0,0 +1,185 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_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.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing SensitivityLabel. + */ +public interface SensitivityLabel 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 labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SensitivityLabel definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithColumn, DefinitionStages.WithCreate { + } + + /** + * Grouping of SensitivityLabel definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SensitivityLabel definition. + */ + interface Blank extends WithColumn { + } + + /** + * The stage of the sensitivitylabel definition allowing to specify Column. + */ + interface WithColumn { + /** + * Specifies resourceGroupName, serverName, databaseName, schemaName, tableName, columnName. + */ + WithCreate withExistingColumn(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + */ + WithCreate withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + */ + WithCreate withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + */ + WithCreate withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + */ + WithCreate withLabelName(String labelName); + } + + /** + * 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 { + } + } + /** + * The template for a SensitivityLabel update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithInformationType, UpdateStages.WithInformationTypeId, UpdateStages.WithLabelId, UpdateStages.WithLabelName { + } + + /** + * Grouping of SensitivityLabel update stages. + */ + interface UpdateStages { + /** + * The stage of the sensitivitylabel update allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + */ + Update withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabel update allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + */ + Update withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabel update allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + */ + Update withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabel update allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + */ + Update withLabelName(String labelName); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java new file mode 100644 index 0000000000000..436333e89dae5 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_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.v2017_03_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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java new file mode 100644 index 0000000000000..c264a024ff3fa --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; + +/** + * Type representing SensitivityLabels. + */ +public interface SensitivityLabels extends SupportsCreating, HasInner { + /** + * 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 serverName The name of the server. + * @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 serverName, 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 serverName The name of the server. + * @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 serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java new file mode 100644 index 0000000000000..bcbcdd452d1a4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class DatabasisServerSensitivityLabelImpl extends WrapperImpl implements DatabasisServerSensitivityLabel { + private final SqlManager manager; + + DatabasisServerSensitivityLabelImpl(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 String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java new file mode 100644 index 0000000000000..6de66ebdc06d8 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabelModel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class DatabasisServerSensitivityLabelModelImpl extends WrapperImpl implements DatabasisServerSensitivityLabelModel { + private final SqlManager manager; + + DatabasisServerSensitivityLabelModelImpl(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 String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..8bbe2a989a9a4 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabelModel; + +class RecommendedSensitivityLabelsImpl extends WrapperImpl implements RecommendedSensitivityLabels { + private final SqlManager manager; + + RecommendedSensitivityLabelsImpl(SqlManager manager) { + super(manager.inner().recommendedSensitivityLabels()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabasisServerSensitivityLabelModelImpl wrapModel(SensitivityLabelInner inner) { + return new DatabasisServerSensitivityLabelModelImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + RecommendedSensitivityLabelsInner 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 DatabasisServerSensitivityLabelModel call(SensitivityLabelInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java new file mode 100644 index 0000000000000..30c2ce8abd92c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java @@ -0,0 +1,447 @@ +/** + * 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.v2017_03_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 RecommendedSensitivityLabels. + */ +public class RecommendedSensitivityLabelsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendedSensitivityLabelsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedSensitivityLabelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendedSensitivityLabelsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecommendedSensitivityLabelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecommendedSensitivityLabels to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendedSensitivityLabelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @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.v2017_03_01_preview.RecommendedSensitivityLabels listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 serverName The name of the server. + * @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 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 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 serverName The name of the server. + * @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 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 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 serverName The name of the server. + * @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> 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 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 serverName The name of the server. + * @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>> 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 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 serverName The name of the server. + * @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>> 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."); + } + final String skipToken = null; + final String filter = null; + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), skipToken, filter, 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); + } + } + }); + } + + /** + * 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 listByDatabase(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(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 serverName The name of the server. + * @param databaseName The name of the database. + * @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> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(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 serverName The name of the server. + * @param databaseName The name of the database. + * @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> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName, 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, 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(listByDatabaseNextWithServiceResponseAsync(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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + 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>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + 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(), skipToken, filter, 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 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 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 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> 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 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> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(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>> 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 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>> 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/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java new file mode 100644 index 0000000000000..0eba2e3799436 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabel; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class SensitivityLabelImpl extends CreatableUpdatableImpl implements SensitivityLabel, SensitivityLabel.Definition, SensitivityLabel.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String schemaName; + private String tableName; + private String columnName; + + SensitivityLabelImpl(String name, SqlManager manager) { + super(name, new SensitivityLabelInner()); + this.manager = manager; + // Set resource name + this.columnName = name; + // + } + + SensitivityLabelImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.columnName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + 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() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.getAsync(this.resourceGroupName, this.serverName, 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 String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SensitivityLabelImpl withExistingColumn(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.schemaName = schemaName; + this.tableName = tableName; + this.columnName = columnName; + return this; + } + + @Override + public SensitivityLabelImpl withInformationType(String informationType) { + this.inner().withInformationType(informationType); + return this; + } + + @Override + public SensitivityLabelImpl withInformationTypeId(String informationTypeId) { + this.inner().withInformationTypeId(informationTypeId); + return this; + } + + @Override + public SensitivityLabelImpl withLabelId(String labelId) { + this.inner().withLabelId(labelId); + return this; + } + + @Override + public SensitivityLabelImpl withLabelName(String labelName) { + this.inner().withLabelName(labelName); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java new file mode 100644 index 0000000000000..a283349393ebf --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.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.v2017_03_01_preview.implementation; + +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; + + /** + * 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; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java new file mode 100644 index 0000000000000..31534a7af4552 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java @@ -0,0 +1,86 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabel; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; + +class SensitivityLabelsImpl extends WrapperImpl implements SensitivityLabels { + private final SqlManager manager; + + SensitivityLabelsImpl(SqlManager manager) { + super(manager.inner().sensitivityLabels()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SensitivityLabelImpl define(String name) { + return wrapModel(name); + } + + private SensitivityLabelImpl wrapModel(SensitivityLabelInner inner) { + return new SensitivityLabelImpl(inner, manager()); + } + + private SensitivityLabelImpl wrapModel(String name) { + return new SensitivityLabelImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + SensitivityLabelsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) + .map(new Func1() { + @Override + public SensitivityLabel call(SensitivityLabelInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + SensitivityLabelsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + private DatabasisServerSensitivityLabelImpl wrapDatabasisServerSensitivityLabelModel(SensitivityLabelInner inner) { + return new DatabasisServerSensitivityLabelImpl(inner, manager()); + } + + @Override + public Observable listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + SensitivityLabelsInner client = this.inner(); + return client.listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DatabasisServerSensitivityLabel call(SensitivityLabelInner inner) { + return wrapDatabasisServerSensitivityLabelModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java new file mode 100644 index 0000000000000..29f800ff8fea7 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java @@ -0,0 +1,818 @@ +/** + * 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.v2017_03_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.v2017_03_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.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 SensitivityLabels. + */ +public class SensitivityLabelsInner { + /** The Retrofit service to perform REST calls. */ + private SensitivityLabelsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SensitivityLabelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SensitivityLabelsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SensitivityLabelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SensitivityLabels to be + * used by Retrofit to perform actually REST calls. + */ + interface SensitivityLabelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels listCurrentByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels") + Observable> listCurrentByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v2017_03_01_preview.SensitivityLabels get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v2017_03_01_preview.SensitivityLabels createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v2017_03_01_preview.SensitivityLabels delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.v2017_03_01_preview.SensitivityLabels listCurrentByDatabaseNext" }) + @GET + Observable> listCurrentByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 serverName The name of the server. + * @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 serverName, final String databaseName) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName) { + return listCurrentByDatabaseSinglePageAsync(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(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 serverName The name of the server. + * @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 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."); + } + final String filter = null; + return service.listCurrentByDatabase(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName, final String filter) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName, final String filter) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, final String databaseName, final String filter) { + return listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, 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 serverName The name of the server. + 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 serverName, final String databaseName, final String filter) { + 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.listCurrentByDatabase(resourceGroupName, serverName, 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 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, 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 (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 (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, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, 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 (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 (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, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, 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 serverName The name of the server. + * @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 serverName, String databaseName, String schemaName, String tableName, String columnName) { + 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 (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, serverName, 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); + } + + /** + * 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java index 3e441c6be62ca..762bdaeaf67a8 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java @@ -522,6 +522,32 @@ public ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicie return this.managedServerSecurityAlertPolicies; } + /** + * The SensitivityLabelsInner object to access its operations. + */ + private SensitivityLabelsInner sensitivityLabels; + + /** + * Gets the SensitivityLabelsInner object to access its operations. + * @return the SensitivityLabelsInner object. + */ + public SensitivityLabelsInner sensitivityLabels() { + return this.sensitivityLabels; + } + + /** + * The RecommendedSensitivityLabelsInner object to access its operations. + */ + private RecommendedSensitivityLabelsInner recommendedSensitivityLabels; + + /** + * Gets the RecommendedSensitivityLabelsInner object to access its operations. + * @return the RecommendedSensitivityLabelsInner object. + */ + public RecommendedSensitivityLabelsInner recommendedSensitivityLabels() { + return this.recommendedSensitivityLabels; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -587,6 +613,8 @@ protected void initialize() { this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesInner(restClient().retrofit(), this); this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesInner(restClient().retrofit(), this); this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.sensitivityLabels = new SensitivityLabelsInner(restClient().retrofit(), this); + this.recommendedSensitivityLabels = new RecommendedSensitivityLabelsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java index d14cd0893ed9b..1986ddeb98fe0 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java @@ -46,6 +46,8 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -83,6 +85,8 @@ public final class SqlManager extends ManagerCore Date: Thu, 28 Feb 2019 12:30:55 -0800 Subject: [PATCH 17/17] Generated from a03ebb5e6ea5c7aa1585f40be78db1703c328084 (#2988) Adding virtualclusters.json to readme.md --- .../v2015_05_01_preview/ManagedInstance.java | 35 +- .../ManagedInstanceProxyOverride.java | 44 + .../ManagedInstanceUpdate.java | 59 +- .../v2015_05_01_preview/VirtualCluster.java | 63 ++ .../VirtualClusterUpdate.java | 104 ++ .../v2015_05_01_preview/VirtualClusters.java | 24 + .../implementation/ManagedInstanceImpl.java | 20 +- .../implementation/ManagedInstanceInner.java | 60 +- .../SqlManagementClientImpl.java | 14 + .../implementation/SqlManager.java | 12 + .../implementation/VirtualClusterImpl.java | 81 ++ .../implementation/VirtualClusterInner.java | 78 ++ .../implementation/VirtualClustersImpl.java | 133 +++ .../implementation/VirtualClustersInner.java | 963 ++++++++++++++++++ 14 files changed, 1671 insertions(+), 19 deletions(-) create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceProxyOverride.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.java create mode 100644 sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java index 8a82ab1ff7c8d..694657cfb63c0 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java @@ -67,7 +67,7 @@ public interface ManagedInstance extends HasInner, Resourc /** * @return the proxyOverride value. */ - String proxyOverride(); + ManagedInstanceProxyOverride proxyOverride(); /** * @return the publicDataEndpointEnabled value. @@ -94,6 +94,11 @@ public interface ManagedInstance extends HasInner, Resourc */ String subnetId(); + /** + * @return the timezoneId value. + */ + String timezoneId(); + /** * @return the vCores value. */ @@ -188,7 +193,7 @@ interface WithProxyOverride { /** * Specifies proxyOverride. */ - WithCreate withProxyOverride(String proxyOverride); + WithCreate withProxyOverride(ManagedInstanceProxyOverride proxyOverride); } /** @@ -231,6 +236,16 @@ interface WithSubnetId { WithCreate withSubnetId(String subnetId); } + /** + * The stage of the managedinstance update allowing to specify TimezoneId. + */ + interface WithTimezoneId { + /** + * Specifies timezoneId. + */ + WithCreate withTimezoneId(String timezoneId); + } + /** * The stage of the managedinstance update allowing to specify VCores. */ @@ -246,13 +261,13 @@ interface WithVCores { * 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.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithProxyOverride, DefinitionStages.WithPublicDataEndpointEnabled, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithProxyOverride, DefinitionStages.WithPublicDataEndpointEnabled, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithTimezoneId, DefinitionStages.WithVCores { } } /** * The template for a ManagedInstance update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithProxyOverride, UpdateStages.WithPublicDataEndpointEnabled, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithVCores { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithProxyOverride, UpdateStages.WithPublicDataEndpointEnabled, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithTimezoneId, UpdateStages.WithVCores { } /** @@ -316,7 +331,7 @@ interface WithProxyOverride { /** * Specifies proxyOverride. */ - Update withProxyOverride(String proxyOverride); + Update withProxyOverride(ManagedInstanceProxyOverride proxyOverride); } /** @@ -359,6 +374,16 @@ interface WithSubnetId { Update withSubnetId(String subnetId); } + /** + * The stage of the managedinstance {0} allowing to specify TimezoneId. + */ + interface WithTimezoneId { + /** + * Specifies timezoneId. + */ + Update withTimezoneId(String timezoneId); + } + /** * The stage of the managedinstance {0} allowing to specify VCores. */ diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceProxyOverride.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceProxyOverride.java new file mode 100644 index 0000000000000..3ad67fc38a27e --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_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.v2015_05_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/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java index 72797cec11d1d..45e031ae3f5ea 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java @@ -100,10 +100,27 @@ public class ManagedInstanceUpdate { private Boolean publicDataEndpointEnabled; /** - * Proxy override of the managed instance. + * Connection type used for connecting to the instance. Possible values + * include: 'Proxy', 'Redirect', 'Default'. */ @JsonProperty(value = "properties.proxyOverride") - private String proxyOverride; + private ManagedInstanceProxyOverride proxyOverride; + + /** + * Id of the timezone. Allowed values are timezones supported by Windows. + * Winodws 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; /** * Resource tags. @@ -339,25 +356,55 @@ public ManagedInstanceUpdate withPublicDataEndpointEnabled(Boolean publicDataEnd } /** - * Get proxy override of the managed instance. + * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. * * @return the proxyOverride value */ - public String proxyOverride() { + public ManagedInstanceProxyOverride proxyOverride() { return this.proxyOverride; } /** - * Set proxy override of the managed instance. + * 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(String proxyOverride) { + public ManagedInstanceUpdate withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { this.proxyOverride = proxyOverride; return this; } + /** + * Get id of the timezone. Allowed values are timezones supported by Windows. + Winodws 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. + Winodws 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 resource tags. * diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.java new file mode 100644 index 0000000000000..60f76f8c74ccc --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.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.v2015_05_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.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.VirtualClusterInner; + +/** + * Type representing VirtualCluster. + */ +public interface VirtualCluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the childResources value. + */ + List childResources(); + + /** + * @return the family value. + */ + String family(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * The template for a VirtualCluster update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithFamily { + } + + /** + * Grouping of VirtualCluster update stages. + */ + interface UpdateStages { + /** + * The stage of the virtualcluster {0} allowing to specify Family. + */ + interface WithFamily { + /** + * Specifies family. + */ + Update withFamily(String family); + } + + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java new file mode 100644 index 0000000000000..435181c8a70ea --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java @@ -0,0 +1,104 @@ +/** + * 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.v2015_05_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database virtual cluster. + */ +@JsonFlatten +public class VirtualClusterUpdate { + /** + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "properties.subnetId", access = JsonProperty.Access.WRITE_ONLY) + private String subnetId; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "properties.family") + private String family; + + /** + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "properties.childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get subnet resource ID for the virtual cluster. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * 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 VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get list of resources in this virtual cluster. + * + * @return the childResources value + */ + public List childResources() { + return this.childResources; + } + + /** + * 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 VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java new file mode 100644 index 0000000000000..f440a13217241 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java @@ -0,0 +1,24 @@ +/** + * 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.v2015_05_01_preview; + +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.v2015_05_01_preview.implementation.VirtualClustersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualClusters. + */ +public interface VirtualClusters extends SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java index 532f3862d93e4..f81ad888b216c 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java @@ -14,6 +14,7 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceUpdate; import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceProxyOverride; import rx.functions.Func1; class ManagedInstanceImpl extends GroupableResourceCoreImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { @@ -107,7 +108,7 @@ public String licenseType() { } @Override - public String proxyOverride() { + public ManagedInstanceProxyOverride proxyOverride() { return this.inner().proxyOverride(); } @@ -136,6 +137,11 @@ public String subnetId() { return this.inner().subnetId(); } + @Override + public String timezoneId() { + return this.inner().timezoneId(); + } + @Override public Integer vCores() { return this.inner().vCores(); @@ -198,7 +204,7 @@ public ManagedInstanceImpl withLicenseType(String licenseType) { } @Override - public ManagedInstanceImpl withProxyOverride(String proxyOverride) { + public ManagedInstanceImpl withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { if (isInCreateMode()) { this.inner().withProxyOverride(proxyOverride); } else { @@ -247,6 +253,16 @@ public ManagedInstanceImpl withSubnetId(String subnetId) { 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()) { diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java index 06120a103474a..b7096d9e578f1 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceProxyOverride; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -108,10 +109,27 @@ public class ManagedInstanceInner extends Resource { private Boolean publicDataEndpointEnabled; /** - * Proxy override of the managed instance. + * Connection type used for connecting to the instance. Possible values + * include: 'Proxy', 'Redirect', 'Default'. */ @JsonProperty(value = "properties.proxyOverride") - private String proxyOverride; + private ManagedInstanceProxyOverride proxyOverride; + + /** + * Id of the timezone. Allowed values are timezones supported by Windows. + * Winodws 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; /** * Get the Azure Active Directory identity of the managed instance. @@ -361,23 +379,53 @@ public ManagedInstanceInner withPublicDataEndpointEnabled(Boolean publicDataEndp } /** - * Get proxy override of the managed instance. + * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. * * @return the proxyOverride value */ - public String proxyOverride() { + public ManagedInstanceProxyOverride proxyOverride() { return this.proxyOverride; } /** - * Set proxy override of the managed instance. + * 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(String proxyOverride) { + public ManagedInstanceInner withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { this.proxyOverride = proxyOverride; return this; } + /** + * Get id of the timezone. Allowed values are timezones supported by Windows. + Winodws 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. + Winodws 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; + } + } diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java index b2b988c342258..561bb4ea50a12 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java @@ -340,6 +340,19 @@ public SubscriptionUsagesInner subscriptionUsages() { return this.subscriptionUsages; } + /** + * The VirtualClustersInner object to access its operations. + */ + private VirtualClustersInner virtualClusters; + + /** + * Gets the VirtualClustersInner object to access its operations. + * @return the VirtualClustersInner object. + */ + public VirtualClustersInner virtualClusters() { + return this.virtualClusters; + } + /** * The VirtualNetworkRulesInner object to access its operations. */ @@ -404,6 +417,7 @@ protected void initialize() { this.syncGroups = new SyncGroupsInner(restClient().retrofit(), this); this.syncMembers = new SyncMembersInner(restClient().retrofit(), this); this.subscriptionUsages = new SubscriptionUsagesInner(restClient().retrofit(), this); + this.virtualClusters = new VirtualClustersInner(restClient().retrofit(), this); this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java index 7fa51ffb32511..04f21c8a2b56b 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java @@ -32,6 +32,7 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroups; import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMembers; import com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsages; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters; import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRules; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -56,6 +57,7 @@ public final class SqlManager extends ManagerCore implements VirtualCluster, VirtualCluster.Update { + private VirtualClusterUpdate updateParameter; + VirtualClusterImpl(String name, VirtualClusterInner inner, SqlManager manager) { + super(name, inner, manager); + this.updateParameter = new VirtualClusterUpdate(); + } + + @Override + public Observable createResourceAsync() { + VirtualClustersInner client = this.manager().inner().virtualClusters(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + VirtualClustersInner client = this.manager().inner().virtualClusters(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public VirtualClusterInner call(VirtualClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualClustersInner client = this.manager().inner().virtualClusters(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new VirtualClusterUpdate(); + } + + @Override + public List childResources() { + return this.inner().childResources(); + } + + @Override + public String family() { + return this.inner().family(); + } + + @Override + public String subnetId() { + return this.inner().subnetId(); + } + + @Override + public VirtualClusterImpl withFamily(String family) { + this.updateParameter.withFamily(family); + return this; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.java new file mode 100644 index 0000000000000..169c61cbd7a60 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.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.v2015_05_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL virtual cluster. + */ +@JsonFlatten +public class VirtualClusterInner extends Resource { + /** + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "properties.subnetId", access = JsonProperty.Access.WRITE_ONLY) + private String subnetId; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "properties.family") + private String family; + + /** + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "properties.childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /** + * Get subnet resource ID for the virtual cluster. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * 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 VirtualClusterInner object itself. + */ + public VirtualClusterInner withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get list of resources in this virtual cluster. + * + * @return the childResources value + */ + public List childResources() { + return this.childResources; + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.java new file mode 100644 index 0000000000000..3ae24cca47468 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.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. + * def + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualCluster; +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 VirtualClustersImpl extends GroupableResourcesCoreImpl implements VirtualClusters { + protected VirtualClustersImpl(SqlManager manager) { + super(manager.inner().virtualClusters(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + VirtualClustersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + VirtualClustersInner 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) { + VirtualClustersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + VirtualClustersInner 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 VirtualCluster call(VirtualClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + VirtualClustersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + VirtualClustersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualCluster call(VirtualClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + protected VirtualClusterImpl wrapModel(VirtualClusterInner inner) { + return new VirtualClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected VirtualClusterImpl wrapModel(String name) { + return null; // Model is not creatable + } + +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java new file mode 100644 index 0000000000000..609b331f3085b --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java @@ -0,0 +1,963 @@ +/** + * 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.v2015_05_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.v2015_05_01_preview.VirtualClusterUpdate; +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.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 VirtualClusters. + */ +public class VirtualClustersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private VirtualClustersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualClustersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualClustersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(VirtualClustersService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualClusters to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualClustersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters") + 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.v2015_05_01_preview.VirtualClusters listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters") + 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.v2015_05_01_preview.VirtualClusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @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.v2015_05_01_preview.VirtualClusters delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @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.v2015_05_01_preview.VirtualClusters beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @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.v2015_05_01_preview.VirtualClusters update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @Path("subscriptionId") String subscriptionId, @Body VirtualClusterUpdate 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.v2015_05_01_preview.VirtualClusters beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @Path("subscriptionId") String subscriptionId, @Body VirtualClusterUpdate 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.v2015_05_01_preview.VirtualClusters listNext" }) + @GET + Observable> listNext(@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.v2015_05_01_preview.VirtualClusters listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of all virtualClusters 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<VirtualClusterInner> 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 virtualClusters 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 virtualClusters in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> 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 virtualClusters in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualClusterInner> 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 virtual clusters 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<VirtualClusterInner> 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 virtual clusters 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 virtual clusters 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<VirtualClusterInner> 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 virtual clusters 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<VirtualClusterInner> 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 virtual clusters 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<VirtualClusterInner> 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 virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 VirtualClusterInner object if successful. + */ + public VirtualClusterInner getByResourceGroup(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualClusterName).toBlocking().single().body(); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualClusterName), serviceCallback); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualClusterName).map(new Func1, VirtualClusterInner>() { + @Override + public VirtualClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String virtualClusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName 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, virtualClusterName, 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 virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName) { + deleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).toBlocking().last().body(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, virtualClusterName), serviceCallback); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String virtualClusterName) { + return deleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String virtualClusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName 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, virtualClusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).toBlocking().single().body(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualClusterName), serviceCallback); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String virtualClusterName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String virtualClusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName 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, virtualClusterName, 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 virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 VirtualClusterInner object if successful. + */ + public VirtualClusterInner update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).toBlocking().last().body(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, VirtualClusterUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters), serviceCallback); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, VirtualClusterUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).map(new Func1, VirtualClusterInner>() { + @Override + public VirtualClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, VirtualClusterUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName 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, virtualClusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 VirtualClusterInner object if successful. + */ + public VirtualClusterInner beginUpdate(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).toBlocking().single().body(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @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 virtualClusterName, VirtualClusterUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters), serviceCallback); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).map(new Func1, VirtualClusterInner>() { + @Override + public VirtualClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName 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, virtualClusterName, 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 virtualClusters 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<VirtualClusterInner> 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 virtualClusters 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 virtualClusters 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<VirtualClusterInner> 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 virtualClusters 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<VirtualClusterInner> 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 virtualClusters 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<VirtualClusterInner> 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); + } + + /** + * Gets a list of virtual clusters 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<VirtualClusterInner> 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 virtual clusters 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 virtual clusters 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<VirtualClusterInner> 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 virtual clusters 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<VirtualClusterInner> 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 virtual clusters 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<VirtualClusterInner> 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); + } + +}